-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
feat: TF_CLI_ARGS_*
Handling for -var-file
#898
base: main
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughThe pull request focuses on improving the handling of Terraform command-line arguments and environment variables in the Atmos shell utility functions. The changes introduce a more robust approach to managing Changes
Assessment against linked issues
Possibly related PRs
Suggested reviewers
Tip CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command 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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
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 (1)
internal/exec/terraform.go (1)
262-264
: Catching var-file collisions in component environment ensures thorough coverage.
These lines do a great job of warning users when environment-level settings might be overridden.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
internal/exec/shell_utils.go
(1 hunks)internal/exec/terraform.go
(1 hunks)
🔇 Additional comments (4)
internal/exec/shell_utils.go (3)
188-190
: Neat definition of terraform commands.
This approach centralizes the commands that may require var-file handling, simplifying future maintenance and extension.
191-197
: Clear warning message for potential collisions.
It is helpful to log a warning whenever these TF_CLI_ARGS variables contain a “-var-file” argument, reducing user confusion.
198-200
: Appending the var file reference to each command is straightforward.
Ensure users understand that this logic overrides any existing “-var-file” specification at runtime.
internal/exec/terraform.go (1)
248-257
: Collisions detection is consistent with shell_utils.
Capturing conflicts across both the shell and terraform commands maintains consistent user visibility.
u.LogWarning(atmosConfig, "Found var-file in environment! This may be overwritten by Atmos") | ||
} | ||
// Set the Terraform environment variable to reference the var file | ||
componentEnvList = append(componentEnvList, fmt.Sprintf("%s=-var-file=%s", envVar, varFile)) |
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.
We still haven't solved the underlying intent here which is that we should also allow the user to specify their own TF_CLI_ARGS, which would be appending to the current value of the corresponding ENV. Now we squash whatever value was there. If the value is set to anything, not just a var file, we should warn that this could interfere with atmos behavior.
what
TF_CLI_ARGS_*
environment variable for-var-file
, since this may conflict with Atmos generated var files.terraform shell
,terraform
as a ENV var,terraform
as a componentenv
varwhy
references
Summary by CodeRabbit
New Features
-var-file
arguments.Bug Fixes