-
Notifications
You must be signed in to change notification settings - Fork 1
Add multiple cloud support to generate-module command #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
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>
WalkthroughThe 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
Sequence DiagramsequenceDiagram
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
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Comment |
|
Note Docstrings generation - SUCCESS |
Docstrings generation was requested by @SatyendraGollaFacets. * #80 (comment) The following files were modified: * `ftf_cli/commands/generate_module.py`
There was a problem hiding this 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 - azureAlternatively, 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
📒 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.j2uses the newcloudsparameter (line 4). The other templates (main.tf.j2,outputs.tf.j2,variables.tf.j2) don't referencecloudsorcloud, so they safely ignore the additional parameter. The originalcloudparameter 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>
Summary
Enable
generate-modulecommand to accept multiple clouds with full backward compatibility. Users can now specify either a single cloud or comma-separated multiple clouds.Changes Made
generate_module.pyfacets.yaml.j2template to render clouds as proper YAML arrayExamples
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):
Testing
All test cases verified:
🤖 Generated with Claude Code
Summary by CodeRabbit
Documentation
New Features