Skip to content

Conversation

@SatyendraGollaFacets
Copy link

@SatyendraGollaFacets SatyendraGollaFacets commented Oct 31, 2025

Summary

Enable generate-module command to accept multiple clouds with full backward compatibility. Users can now specify either a single cloud or comma-separated multiple clouds.

Changes Made

  • ✅ Parse comma-separated cloud input into list in generate_module.py
  • ✅ Update facets.yaml.j2 template to render clouds as proper YAML array
  • ✅ Update README.md documentation with multiple cloud examples

Examples

Single cloud (backward compatible):

ftf generate-module -c aws
# Results in: clouds: ['aws']

Multiple clouds (new feature):

ftf generate-module -c aws,gcp,azure
# Results in: clouds: ['aws', 'gcp', 'azure']

With spaces (automatically stripped):

ftf generate-module -c "aws, gcp , azure"
# Results in: clouds: ['aws', 'gcp', 'azure']

Testing

All test cases verified:

  • ✅ Single cloud input works
  • ✅ Multiple comma-separated clouds work
  • ✅ Whitespace around commas is stripped correctly
  • ✅ Backward compatibility maintained

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation

    • Clarified the -c/--cloud CLI help to show multiple clouds can be specified as comma-separated values (e.g., aws,gcp,azure).
  • New Features

    • Generate Module now accepts and processes multiple cloud providers in one command, producing module output that reflects the specified multi-cloud configuration.

Enable generate-module command to accept multiple clouds with backward
compatibility. Users can now specify either single cloud (-c aws) or
comma-separated multiple clouds (-c aws,gcp,azure).

Changes:
- Parse comma-separated cloud input into list in generate_module.py
- Update facets.yaml.j2 template to render clouds as proper YAML array
- Update README.md documentation with multiple cloud examples

Backward compatibility:
- Single cloud input continues to work: -c aws → clouds: ['aws']
- Multiple clouds now supported: -c aws,gcp,azure → clouds: ['aws', 'gcp', 'azure']
- Whitespace handling: spaces around commas are automatically stripped

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Oct 31, 2025

Walkthrough

The CLI's Generate Module option now accepts multiple comma-separated cloud providers; input is parsed into a list, passed to template rendering, and the facets.yaml.j2 template now renders the clouds value directly instead of wrapping a single value in a list.

Changes

Cohort / File(s) Summary
Documentation
README.md
Updated -c, --cloud option description to document support for multiple comma-separated cloud providers (e.g., aws,gcp,azure).
CLI parsing & rendering
ftf_cli/commands/generate_module.py
Extended docstring; parse cloud input into cloud_list by splitting on commas and trimming whitespace; pass clouds=cloud_list into template rendering context.
Template updates
ftf_cli/commands/templates/facets.yaml.j2
Changed rendering from clouds: [ {{ cloud }} ] to clouds: {{ clouds }} so the template receives and emits the clouds list directly.

Sequence Diagram

sequenceDiagram
    participant User
    participant CLI as generate_module.py
    participant Template as facets.yaml.j2
    participant Output

    User->>CLI: Provide cloud input (e.g., "aws,gcp,azure")
    CLI->>CLI: Split input on commas & trim whitespace -> cloud_list
    CLI->>Template: Render template with clouds=cloud_list
    Template->>Template: Emit clouds field directly from provided list
    Template->>Output: Produce facets YAML including clouds list
Loading

Suggested reviewers

  • sanmesh-kakade

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "Add multiple cloud support to generate-module command" directly and clearly summarizes the primary objective of the changeset. The title accurately reflects the main changes across all modified files: enabling the generate-module command to accept multiple comma-separated cloud inputs while maintaining backward compatibility. The title is concise, specific (avoiding vague terms), and provides sufficient context that a teammate reviewing the git history would immediately understand the core purpose of the changes.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch add-multiple-cloud-support

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 34775c6 and 79f36bb.

📒 Files selected for processing (1)
  • ftf_cli/commands/generate_module.py (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • ftf_cli/commands/generate_module.py

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai
Copy link

coderabbitai bot commented Oct 31, 2025

Note

Docstrings generation - SUCCESS
Generated docstrings for this pull request at #81

coderabbitai bot added a commit that referenced this pull request Oct 31, 2025
Docstrings generation was requested by @SatyendraGollaFacets.

* #80 (comment)

The following files were modified:

* `ftf_cli/commands/generate_module.py`
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
ftf_cli/commands/generate_module.py (1)

60-61: Parsing logic is correct and handles whitespace well.

The implementation correctly splits comma-separated values and trims whitespace, maintaining backward compatibility for single-cloud input.

Consider adding validation to handle edge cases:

  • Empty strings from trailing commas (e.g., "aws,gcp,"['aws', 'gcp', ''])
  • Empty cloud input (e.g., ""[''])
 # Parse cloud input: supports both single ("aws") and multiple ("aws,azure,gcp")
-cloud_list = [c.strip() for c in cloud.split(',')]
+cloud_list = [c.strip() for c in cloud.split(',') if c.strip()]
+if not cloud_list:
+    raise click.UsageError("❌ Cloud provider cannot be empty.")
ftf_cli/commands/templates/facets.yaml.j2 (1)

4-4: Consider more idiomatic YAML list rendering.

The current implementation works correctly (Python list syntax is valid YAML), but produces output like clouds: ['aws', 'gcp'] with Python-style quotes. More idiomatic YAML would improve readability.

Apply this diff for cleaner YAML output using Jinja2 list rendering:

-clouds: {{ clouds }}
+clouds:
+{% for cloud_item in clouds %}
+  - {{ cloud_item }}
+{% endfor %}

This produces:

clouds:
  - aws
  - gcp
  - azure

Alternatively, for a more compact flow style:

-clouds: {{ clouds }}
+clouds: [{{ clouds|join(', ') }}]

This produces: clouds: [aws, gcp, azure]

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ca23efb and 34775c6.

📒 Files selected for processing (3)
  • README.md (1 hunks)
  • ftf_cli/commands/generate_module.py (2 hunks)
  • ftf_cli/commands/templates/facets.yaml.j2 (1 hunks)
🔇 Additional comments (2)
README.md (1)

98-98: LGTM! Clear documentation of the multi-cloud support.

The updated help text effectively communicates that the option now supports both single and comma-separated cloud providers with concrete examples.

ftf_cli/commands/generate_module.py (1)

71-78: Verification complete—change is safe and maintains backward compatibility.

Only facets.yaml.j2 uses the new clouds parameter (line 4). The other templates (main.tf.j2, outputs.tf.j2, variables.tf.j2) don't reference clouds or cloud, so they safely ignore the additional parameter. The original cloud parameter remains passed for backward compatibility.

Docstrings generation was requested by @SatyendraGollaFacets.

* #80 (comment)

The following files were modified:

* `ftf_cli/commands/generate_module.py`

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants