Skip to content
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

add support for terraform version #846

Merged
merged 6 commits into from
Dec 15, 2024
Merged

add support for terraform version #846

merged 6 commits into from
Dec 15, 2024

Conversation

samtholiya
Copy link
Collaborator

@samtholiya samtholiya commented Dec 12, 2024

what

With this fix we would be supporting terraform version

why

We say atmos supports all native terraform commands, yet we do not support atmos terraform version.

current implementation example

image

references

issue: https://linear.app/cloudposse/issue/DEV-2820/atmos-terraform-version-does-not-work

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Added support for the version command to display the current Terraform version.
  • Improvements

    • Enhanced logic for the clean subcommand to better handle --everything and --force flags.
    • Streamlined command-line argument processing to prevent help flag activation when the version command is used.
  • Documentation

    • Updated comments related to command help display for clarity.

@samtholiya samtholiya requested review from a team as code owners December 12, 2024 11:20
Copy link
Contributor

coderabbitai bot commented Dec 12, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The changes in this pull request introduce new functionality to handle the version subcommand in the ExecuteTerraform function, allowing the program to execute the Terraform version command. Additionally, the handling of the clean subcommand has been refined to check for --everything and --force flags, optimizing stack processing logic. In the processArgsAndFlags function, the logic for setting the NeedHelp flag has been adjusted to prevent it from triggering when the "version" command is used. Overall, these updates enhance command-line argument processing and control flow.

Changes

File Change Summary
internal/exec/terraform.go Added handling for version subcommand and refined logic for clean subcommand.
internal/exec/utils.go Modified processArgsAndFlags to adjust NeedHelp flag logic for single arguments.

Assessment against linked issues

Objective Addressed Explanation
Support atmos terraform version command (DEV-2820)

Possibly related PRs

Suggested labels

minor

Suggested reviewers

  • gberenice
  • osterman
  • johncblandii

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. This feature will be included in our Pro Plan when released.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c659f04 and 9d6ffff.

📒 Files selected for processing (1)
  • internal/exec/terraform.go (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • internal/exec/terraform.go

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary or @auto-summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @auto-title anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@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

🧹 Outside diff range and nitpick comments (1)
internal/exec/utils.go (1)

Line range hint 64-72: Consider adding unit tests for the version command.

While the implementation is solid, adding unit tests would help ensure the version command behavior remains correct as the codebase evolves.

Would you like me to help generate unit test cases for the version command implementation?

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 22c9b28 and c659f04.

📒 Files selected for processing (2)
  • internal/exec/terraform.go (1 hunks)
  • internal/exec/utils.go (1 hunks)
🔇 Additional comments (3)
internal/exec/terraform.go (1)

64-72: LGTM! Clean implementation of the version command.

The implementation correctly handles the terraform version command by executing it directly without any additional processing, which is the expected behavior.

internal/exec/utils.go (2)

664-672: Well-structured handling of the version command.

The logic correctly prevents the help flag from triggering when the version command is used, while maintaining the existing help behavior for other single-argument commands.


674-676: Good code style improvement.

Adding a line break before the helmfile comment improves readability by separating different logical sections.

@samtholiya samtholiya enabled auto-merge (squash) December 13, 2024 07:12
@aknysh aknysh disabled auto-merge December 14, 2024 22:51
@aknysh aknysh added the minor New features that do not break anything label Dec 14, 2024
Copy link
Member

@aknysh aknysh left a comment

Choose a reason for hiding this comment

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

thanks @samtholiya

@aknysh aknysh merged commit e9a610e into main Dec 15, 2024
28 checks passed
@aknysh aknysh deleted the DEV-2820 branch December 15, 2024 00:35
Copy link

These changes were released in v1.126.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor New features that do not break anything
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants