-
-
Notifications
You must be signed in to change notification settings - Fork 139
Update atmos terraform plan command, add --skip-planfile flag
#1385
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
Conversation
# Conflicts: # examples/quick-start-advanced/Dockerfile # website/docs/integrations/atlantis.mdx
|
Important Cloud Posse Engineering Team Review RequiredThis pull request modifies files that require Cloud Posse's review. Please be patient, and a core maintainer will review your changes. To expedite this process, reach out to us on Slack in the |
atmos terraform plan command, add --skip-plan flagatmos terraform plan command, add --skip-planfile flag
📝 WalkthroughWalkthroughThis change introduces a new Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI
participant Config
participant Terraform
User->>CLI: Run 'atmos terraform plan --skip-planfile=true'
CLI->>Config: Parse config/env/flags (skip_planfile = true)
CLI->>Terraform: Build plan command (omit -out flag)
Terraform-->>CLI: Execute plan (no planfile written)
CLI-->>User: Output result
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15–20 minutes Possibly related PRs
Suggested reviewers
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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
|
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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
|
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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
|
|
Warning This PR exceeds the recommended limit of 1,000 lines.Large PRs are difficult to review and may be rejected due to their size. Please verify that this PR does not address multiple issues. |
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: 1
🔭 Outside diff range comments (1)
internal/exec/utils.go (1)
533-537: Missing function reference after refactoring.The
getCliVarsfunction has been moved tocli_utils.gobut is still being called here. This will cause a compilation error.Either:
- Import and use the function from its new location
- Update the call to use the appropriate public API
- cliVars, err := getCliVars(configAndStacksInfo.AdditionalArgsAndFlags) + cliVars, err := GetCliVars(configAndStacksInfo.AdditionalArgsAndFlags)
♻️ Duplicate comments (1)
internal/exec/cli_utils.go (1)
144-643: High complexity in deprecated function.This function has very high cognitive complexity and repetitive patterns. Since it's marked for deprecation pending PR #1174, consider:
- Documenting a migration timeline
- Adding a warning log when this function is used
- Ensuring the replacement implementation addresses these complexity issues
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (6)
go.mod(10 hunks)internal/exec/cli_utils.go(1 hunks)internal/exec/cli_utils_test.go(1 hunks)internal/exec/utils.go(6 hunks)internal/exec/utils_test.go(1 hunks)pkg/config/utils_test.go(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- pkg/config/utils_test.go
- go.mod
🧰 Additional context used
📓 Path-based instructions (2)
**/*.go
📄 CodeRabbit Inference Engine (.cursor/rules/atmos-rules.mdc)
**/*.go: Use Viper for managing configuration, environment variables, and flags
Use interfaces for external dependencies to facilitate mocking
All code must pass golangci-lint checks
Follow Go's error handling idioms
Use meaningful error messages
Wrap errors with context using fmt.Errorf("context: %w", err)
Consider using a custom error type for domain-specific errors
Follow standard Go coding style
Use gofmt and goimports to format code
Prefer short, descriptive variable names
Use snake_case for environment variables
Document all exported functions, types, and methods
Document complex logic with inline comments
Follow Go's documentation conventions
Use Viper for configuration management
Support configuration via files, environment variables, and flags
Follow the precedence order: flags > environment variables > config file > defaults
Files:
internal/exec/utils_test.gointernal/exec/cli_utils_test.gointernal/exec/utils.gointernal/exec/cli_utils.go
**/*_test.go
📄 CodeRabbit Inference Engine (.cursor/rules/atmos-rules.mdc)
**/*_test.go: Every new feature must include comprehensive unit tests
Test both happy paths and error conditions
Use table-driven tests for testing multiple scenarios
Include integration tests for command flows
Test CLI end-to-end when possible
Use test fixtures for complex inputs
Consider using testify/mock for creating mock implementations
Files:
internal/exec/utils_test.gointernal/exec/cli_utils_test.go
🧠 Learnings (63)
📓 Common learnings
Learnt from: Listener430
PR: cloudposse/atmos#934
File: tests/fixtures/scenarios/docs-generate/README.md.gotmpl:99-118
Timestamp: 2025-01-25T03:51:57.689Z
Learning: For the cloudposse/atmos repository, changes to template contents should be handled in dedicated PRs and are typically considered out of scope for PRs focused on other objectives.
Learnt from: osterman
PR: cloudposse/atmos#727
File: internal/exec/terraform.go:114-118
Timestamp: 2024-10-21T17:51:53.976Z
Learning: When `atmos terraform clean --everything` is used without specifying a component and without the `--force` flag, prompt the user for confirmation before deleting all components. Use the `--force` flag to skip the confirmation prompt.
Learnt from: Listener430
PR: cloudposse/atmos#1149
File: tests/snapshots/TestCLICommands_atmos_vendor_pull_ssh.stderr.golden:7-7
Timestamp: 2025-03-18T12:26:25.329Z
Learning: In the Atmos project, typos or inconsistencies in test snapshot files (such as "terrafrom" instead of "terraform") may be intentional as they capture the exact output of commands and should not be flagged as issues requiring correction.
Learnt from: samtholiya
PR: cloudposse/atmos#955
File: tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden:0-0
Timestamp: 2025-01-19T15:49:15.593Z
Learning: In future commits, the help text for Atmos CLI commands should be limited to only show component and stack parameters for commands that actually use them. This applies to the example usage section in command help text.
Learnt from: aknysh
PR: cloudposse/atmos#944
File: go.mod:206-206
Timestamp: 2025-01-17T00:18:57.769Z
Learning: For indirect dependencies with license compliance issues in the cloudposse/atmos repository, the team prefers to handle them in follow-up PRs rather than blocking the current changes, as these issues often require deeper investigation of the dependency tree.
Learnt from: aknysh
PR: cloudposse/atmos#1327
File: cmd/terraform.go:111-117
Timestamp: 2025-06-23T02:14:30.937Z
Learning: In cmd/terraform.go, flags for the DescribeAffected function are added dynamically at runtime when info.Affected is true. This is intentional to avoid exposing internal flags like "file", "format", "verbose", "include-spacelift-admin-stacks", "include-settings", and "upload" in the terraform command interface, while still providing them for the shared DescribeAffected function used by both `atmos describe affected` and `atmos terraform apply --affected`.
Learnt from: aknysh
PR: cloudposse/atmos#810
File: internal/exec/terraform_utils.go:40-213
Timestamp: 2024-12-03T05:18:49.169Z
Learning: In the context of the Atmos project, it's acceptable for functions like `execTerraformOutput` to remain as single functions if they perform a single purpose, such as retrieving Terraform outputs for a component in a stack, even if the function is lengthy.
Learnt from: aknysh
PR: cloudposse/atmos#810
File: examples/tests/stacks/catalog/terraform/template-functions-test2/defaults.yaml:28-32
Timestamp: 2024-12-01T00:33:20.298Z
Learning: In `examples/tests/stacks/catalog/terraform/template-functions-test2/defaults.yaml`, `!exec atmos terraform output` is used in examples to demonstrate its usage, even though `!terraform.output` is the recommended approach according to the documentation.
Learnt from: aknysh
PR: cloudposse/atmos#810
File: internal/exec/terraform_utils.go:145-146
Timestamp: 2024-12-03T05:29:07.718Z
Learning: In the Atmos project, a 5-minute timeout in the `execTerraformOutput` function is acceptable for retrieving `terraform output` for a component in a stack.
Learnt from: Listener430
PR: cloudposse/atmos#825
File: internal/exec/helmfile_generate_varfile.go:28-31
Timestamp: 2024-12-07T16:16:13.038Z
Learning: In `internal/exec/helmfile_generate_varfile.go`, the `--help` command (`./atmos helmfile generate varfile --help`) works correctly without requiring stack configurations, and the only change needed was to make `ProcessCommandLineArgs` exportable by capitalizing its name.
Learnt from: aknysh
PR: cloudposse/atmos#825
File: internal/exec/terraform.go:30-30
Timestamp: 2024-12-07T16:19:01.683Z
Learning: In `internal/exec/terraform.go`, skipping stack validation when help flags are present is not necessary.
Learnt from: samtholiya
PR: cloudposse/atmos#914
File: cmd/terraform_commands.go:260-265
Timestamp: 2025-01-09T22:37:01.004Z
Learning: In the terraform commands implementation (cmd/terraform_commands.go), the direct use of `os.Args[2:]` for argument handling is intentionally preserved to avoid extensive refactoring. While it could be improved to use cobra's argument parsing, such changes should be handled in a dedicated PR to maintain focus and minimize risk.
Learnt from: osterman
PR: cloudposse/atmos#727
File: internal/exec/terraform.go:65-66
Timestamp: 2024-10-31T19:23:45.538Z
Learning: The variable `shouldCheckStack` in `ExecuteTerraform` controls whether validation is performed.
Learnt from: aknysh
PR: cloudposse/atmos#810
File: internal/exec/terraform_utils.go:144-145
Timestamp: 2024-12-03T03:52:02.524Z
Learning: Avoid adding context timeouts to Terraform commands in `execTerraformOutput` because their execution time can vary from seconds to hours, and making it configurable would require redesigning the command interface.
Learnt from: CR
PR: cloudposse/atmos#0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-07-01T02:22:25.901Z
Learning: Applies to **/*.go : Support configuration via files, environment variables, and flags
Learnt from: aknysh
PR: cloudposse/atmos#810
File: website/docs/core-concepts/stacks/yaml-functions/terraform.output.mdx:104-110
Timestamp: 2024-12-03T03:49:30.395Z
Learning: In the documentation for `!terraform.output`, warnings about template variable availability are already covered in other sections, so no need to suggest adding them here.
📚 Learning: applies to **/*_test.go : use table-driven tests for testing multiple scenarios...
Learnt from: CR
PR: cloudposse/atmos#0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-07-01T02:22:25.901Z
Learning: Applies to **/*_test.go : Use table-driven tests for testing multiple scenarios
Applied to files:
internal/exec/utils_test.gointernal/exec/cli_utils_test.go
📚 Learning: in `internal/exec/helmfile_generate_varfile.go`, the `--help` command (`./atmos helmfile generate va...
Learnt from: Listener430
PR: cloudposse/atmos#825
File: internal/exec/helmfile_generate_varfile.go:28-31
Timestamp: 2024-12-07T16:16:13.038Z
Learning: In `internal/exec/helmfile_generate_varfile.go`, the `--help` command (`./atmos helmfile generate varfile --help`) works correctly without requiring stack configurations, and the only change needed was to make `ProcessCommandLineArgs` exportable by capitalizing its name.
Applied to files:
internal/exec/utils_test.gointernal/exec/cli_utils_test.gointernal/exec/utils.gointernal/exec/cli_utils.go
📚 Learning: applies to **/*_test.go : include integration tests for command flows...
Learnt from: CR
PR: cloudposse/atmos#0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-07-01T02:22:25.901Z
Learning: Applies to **/*_test.go : Include integration tests for command flows
Applied to files:
internal/exec/utils_test.gointernal/exec/cli_utils_test.go
📚 Learning: applies to **/*_test.go : use test fixtures for complex inputs...
Learnt from: CR
PR: cloudposse/atmos#0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-07-01T02:22:25.901Z
Learning: Applies to **/*_test.go : Use test fixtures for complex inputs
Applied to files:
internal/exec/utils_test.gointernal/exec/cli_utils_test.go
📚 Learning: applies to **/*_test.go : every new feature must include comprehensive unit tests...
Learnt from: CR
PR: cloudposse/atmos#0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-07-01T02:22:25.901Z
Learning: Applies to **/*_test.go : Every new feature must include comprehensive unit tests
Applied to files:
internal/exec/utils_test.gointernal/exec/cli_utils_test.go
📚 Learning: the `processtmplwithdatasourcesgomplate` function in `internal/exec/template_utils.go` is used for d...
Learnt from: Listener430
PR: cloudposse/atmos#934
File: internal/exec/template_utils.go:268-271
Timestamp: 2025-01-25T03:49:03.951Z
Learning: The `ProcessTmplWithDatasourcesGomplate` function in `internal/exec/template_utils.go` is used for documentation generation purposes, where simple environment variable handling is acceptable and thread-safety concerns are not critical.
Applied to files:
internal/exec/utils_test.gointernal/exec/utils.go
📚 Learning: applies to **/*_test.go : test both happy paths and error conditions...
Learnt from: CR
PR: cloudposse/atmos#0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-07-01T02:22:25.901Z
Learning: Applies to **/*_test.go : Test both happy paths and error conditions
Applied to files:
internal/exec/utils_test.gointernal/exec/cli_utils_test.go
📚 Learning: applies to **/*_test.go : consider using testify/mock for creating mock implementations...
Learnt from: CR
PR: cloudposse/atmos#0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-07-01T02:22:25.901Z
Learning: Applies to **/*_test.go : Consider using testify/mock for creating mock implementations
Applied to files:
internal/exec/utils_test.go
📚 Learning: in the `processtagterraformoutput` function within `internal/exec/yaml_func_terraform_output.go`, pa...
Learnt from: aknysh
PR: cloudposse/atmos#863
File: internal/exec/yaml_func_terraform_output.go:34-38
Timestamp: 2024-12-17T07:08:41.288Z
Learning: In the `processTagTerraformOutput` function within `internal/exec/yaml_func_terraform_output.go`, parameters are separated by spaces and do not contain spaces. Therefore, using `strings.Fields()` for parsing is acceptable, and there's no need to handle parameters with spaces.
Applied to files:
internal/exec/utils_test.gointernal/exec/cli_utils_test.gointernal/exec/utils.go
📚 Learning: in `internal/exec/terraform.go`, skipping stack validation when help flags are present is not necess...
Learnt from: aknysh
PR: cloudposse/atmos#825
File: internal/exec/terraform.go:30-30
Timestamp: 2024-12-07T16:19:01.683Z
Learning: In `internal/exec/terraform.go`, skipping stack validation when help flags are present is not necessary.
Applied to files:
internal/exec/utils_test.gointernal/exec/cli_utils_test.gointernal/exec/utils.gointernal/exec/cli_utils.go
📚 Learning: in the go function `processtagterraformoutput` in `internal/exec/yaml_func_terraform_output.go`, par...
Learnt from: aknysh
PR: cloudposse/atmos#810
File: internal/exec/yaml_func_terraform_output.go:35-40
Timestamp: 2024-11-30T22:07:08.610Z
Learning: In the Go function `processTagTerraformOutput` in `internal/exec/yaml_func_terraform_output.go`, parameters cannot contain spaces. The code splits the input by spaces, and if the parameters contain spaces, `len(parts) != 3` will fail and show an error to the user.
Applied to files:
internal/exec/utils_test.gointernal/exec/cli_utils_test.gointernal/exec/utils.gointernal/exec/cli_utils.go
📚 Learning: in the go code for `componentfunc` in `internal/exec/template_funcs_component.go`, the function `cle...
Learnt from: aknysh
PR: cloudposse/atmos#775
File: internal/exec/template_funcs_component.go:157-159
Timestamp: 2024-11-12T03:16:02.910Z
Learning: In the Go code for `componentFunc` in `internal/exec/template_funcs_component.go`, the function `cleanTerraformWorkspace` does not return errors, and it's acceptable if the file does not exist. Therefore, error handling for `cleanTerraformWorkspace` is not needed.
Applied to files:
internal/exec/utils_test.gointernal/exec/utils.go
📚 Learning: in `examples/tests/stacks/catalog/terraform/template-functions-test2/defaults.yaml`, `!exec atmos te...
Learnt from: aknysh
PR: cloudposse/atmos#810
File: examples/tests/stacks/catalog/terraform/template-functions-test2/defaults.yaml:28-32
Timestamp: 2024-12-01T00:33:20.298Z
Learning: In `examples/tests/stacks/catalog/terraform/template-functions-test2/defaults.yaml`, `!exec atmos terraform output` is used in examples to demonstrate its usage, even though `!terraform.output` is the recommended approach according to the documentation.
Applied to files:
internal/exec/utils_test.go
📚 Learning: in the terraform commands implementation (cmd/terraform_commands.go), the direct use of `os.args[2:]...
Learnt from: samtholiya
PR: cloudposse/atmos#914
File: cmd/terraform_commands.go:260-265
Timestamp: 2025-01-09T22:37:01.004Z
Learning: In the terraform commands implementation (cmd/terraform_commands.go), the direct use of `os.Args[2:]` for argument handling is intentionally preserved to avoid extensive refactoring. While it could be improved to use cobra's argument parsing, such changes should be handled in a dedicated PR to maintain focus and minimize risk.
Applied to files:
internal/exec/utils_test.gointernal/exec/cli_utils_test.gointernal/exec/utils.gointernal/exec/cli_utils.go
📚 Learning: in cmd/terraform.go, flags for the describeaffected function are added dynamically at runtime when i...
Learnt from: aknysh
PR: cloudposse/atmos#1327
File: cmd/terraform.go:111-117
Timestamp: 2025-06-23T02:14:30.937Z
Learning: In cmd/terraform.go, flags for the DescribeAffected function are added dynamically at runtime when info.Affected is true. This is intentional to avoid exposing internal flags like "file", "format", "verbose", "include-spacelift-admin-stacks", "include-settings", and "upload" in the terraform command interface, while still providing them for the shared DescribeAffected function used by both `atmos describe affected` and `atmos terraform apply --affected`.
Applied to files:
internal/exec/utils_test.gointernal/exec/cli_utils_test.gointernal/exec/utils.gointernal/exec/cli_utils.go
📚 Learning: applies to cmd/*.go : provide comprehensive help text for all commands and flags...
Learnt from: CR
PR: cloudposse/atmos#0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-07-01T02:22:25.901Z
Learning: Applies to cmd/*.go : Provide comprehensive help text for all commands and flags
Applied to files:
internal/exec/cli_utils_test.gointernal/exec/utils.gointernal/exec/cli_utils.go
📚 Learning: applies to **/*.go : support configuration via files, environment variables, and flags...
Learnt from: CR
PR: cloudposse/atmos#0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-07-01T02:22:25.901Z
Learning: Applies to **/*.go : Support configuration via files, environment variables, and flags
Applied to files:
internal/exec/cli_utils_test.gointernal/exec/utils.gointernal/exec/cli_utils.go
📚 Learning: in the atmos codebase, using panic for unsupported flag types in flag processing functions like setd...
Learnt from: samtholiya
PR: cloudposse/atmos#1266
File: cmd/describe_affected.go:0-0
Timestamp: 2025-06-07T19:28:21.289Z
Learning: In the Atmos codebase, using panic for unsupported flag types in flag processing functions like setDescribeAffectedFlagValueInCliArgs is the expected behavior rather than returning errors. This pattern is preferred for developer errors when unsupported types are added to the flagsKeyValue map.
Applied to files:
internal/exec/cli_utils_test.gointernal/exec/utils.gointernal/exec/cli_utils.go
📚 Learning: in the atmos codebase, when appending slices with `args := append(configandstacksinfo.cliargs, confi...
Learnt from: aknysh
PR: cloudposse/atmos#1261
File: internal/exec/utils.go:639-640
Timestamp: 2025-05-22T15:42:10.906Z
Learning: In the Atmos codebase, when appending slices with `args := append(configAndStacksInfo.CliArgs, configAndStacksInfo.AdditionalArgsAndFlags...)`, it's intentional that the result is not stored back in the original slice. This pattern is used when the merged result serves a different purpose than the original slices, such as when creating a filtered version for component section assignments.
Applied to files:
internal/exec/utils.gointernal/exec/cli_utils.go
📚 Learning: applies to cmd/*.go : use kebab-case for command-line flags...
Learnt from: CR
PR: cloudposse/atmos#0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-07-01T02:22:25.901Z
Learning: Applies to cmd/*.go : Use kebab-case for command-line flags
Applied to files:
internal/exec/utils.gointernal/exec/cli_utils.go
📚 Learning: in `internal/exec/vendor_utils.go`, the variables `mergedsources` and `mergedimports` are declared a...
Learnt from: Cerebrovinny
PR: cloudposse/atmos#737
File: internal/exec/vendor_utils.go:181-182
Timestamp: 2024-10-31T07:09:31.983Z
Learning: In `internal/exec/vendor_utils.go`, the variables `mergedSources` and `mergedImports` are declared and used later in the code. Do not suggest removing them as unused variables.
Applied to files:
internal/exec/utils.go
📚 Learning: in the `internal/exec/describe_stacks.go` file of the `atmos` project written in go, avoid extractin...
Learnt from: Cerebrovinny
PR: cloudposse/atmos#764
File: internal/exec/describe_stacks.go:289-295
Timestamp: 2024-11-13T21:37:07.852Z
Learning: In the `internal/exec/describe_stacks.go` file of the `atmos` project written in Go, avoid extracting the stack name handling logic into a helper function within the `ExecuteDescribeStacks` method, even if the logic appears duplicated.
Applied to files:
internal/exec/utils.gointernal/exec/cli_utils.go
📚 Learning: in the go codebase for atmos, when reviewing functions like `checkatmosconfig` in `cmd/cmd_utils.go`...
Learnt from: osterman
PR: cloudposse/atmos#740
File: cmd/cmd_utils.go:340-359
Timestamp: 2024-10-23T21:36:40.262Z
Learning: In the Go codebase for Atmos, when reviewing functions like `checkAtmosConfig` in `cmd/cmd_utils.go`, avoid suggesting refactoring to return errors instead of calling `os.Exit` if such changes would significantly increase the scope due to the need to update multiple call sites.
Applied to files:
internal/exec/utils.gointernal/exec/cli_utils.go
📚 Learning: the atmos codebase currently uses `log.fatal` for error handling in multiple places. the maintainers...
Learnt from: aknysh
PR: cloudposse/atmos#1185
File: internal/exec/yaml_func_store.go:26-26
Timestamp: 2025-04-04T02:03:23.676Z
Learning: The Atmos codebase currently uses `log.Fatal` for error handling in multiple places. The maintainers are aware this isn't an ideal pattern (should only be used in main() or init() functions) and plan to address it comprehensively in a separate PR. CodeRabbit should not flag these issues or push for immediate changes until that refactoring is complete.
Applied to files:
internal/exec/utils.gointernal/exec/cli_utils.go
📚 Learning: error handling for `cmd.usage()` is not required in the atmos cli codebase, as confirmed by the main...
Learnt from: samtholiya
PR: cloudposse/atmos#959
File: cmd/workflow.go:74-74
Timestamp: 2025-01-30T19:30:59.120Z
Learning: Error handling for `cmd.Usage()` is not required in the Atmos CLI codebase, as confirmed by the maintainer.
Applied to files:
internal/exec/utils.gointernal/exec/cli_utils.go
📚 Learning: applies to **/*.go : provide clear error messages to users...
Learnt from: CR
PR: cloudposse/atmos#0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-07-01T02:22:25.901Z
Learning: Applies to **/*.go : Provide clear error messages to users
Applied to files:
internal/exec/utils.gointernal/exec/cli_utils.go
📚 Learning: applies to **/*.go : consider using a custom error type for domain-specific errors...
Learnt from: CR
PR: cloudposse/atmos#0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-07-01T02:22:25.901Z
Learning: Applies to **/*.go : Consider using a custom error type for domain-specific errors
Applied to files:
internal/exec/utils.gointernal/exec/cli_utils.go
📚 Learning: in the atmos project, the `u.logerrorandexit` function logs the error and exits the command executio...
Learnt from: aknysh
PR: cloudposse/atmos#820
File: cmd/list_stacks.go:55-56
Timestamp: 2024-12-05T22:33:54.807Z
Learning: In the atmos project, the `u.LogErrorAndExit` function logs the error and exits the command execution appropriately within flag completion functions.
Applied to files:
internal/exec/utils.go
📚 Learning: applies to **/*.go : follow go's error handling idioms...
Learnt from: CR
PR: cloudposse/atmos#0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-07-01T02:22:25.901Z
Learning: Applies to **/*.go : Follow Go's error handling idioms
Applied to files:
internal/exec/utils.gointernal/exec/cli_utils.go
📚 Learning: applies to **/*.go : wrap errors with context using `fmt.errorf("context: %w", err)`...
Learnt from: CR
PR: cloudposse/atmos#0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-07-01T02:22:25.901Z
Learning: Applies to **/*.go : Wrap errors with context using `fmt.Errorf("context: %w", err)`
Applied to files:
internal/exec/utils.gointernal/exec/cli_utils.go
📚 Learning: applies to **/*.go : use meaningful error messages...
Learnt from: CR
PR: cloudposse/atmos#0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-07-01T02:22:25.901Z
Learning: Applies to **/*.go : Use meaningful error messages
Applied to files:
internal/exec/utils.gointernal/exec/cli_utils.go
📚 Learning: in the atmos project, `cliconfig` is initialized within the `cmd` package in `root.go` and can be us...
Learnt from: Listener430
PR: cloudposse/atmos#844
File: cmd/helmfile.go:37-37
Timestamp: 2024-12-11T18:40:12.808Z
Learning: In the atmos project, `cliConfig` is initialized within the `cmd` package in `root.go` and can be used in other command files.
Applied to files:
internal/exec/utils.gointernal/exec/cli_utils.go
📚 Learning: the validate commands in atmos can have different help handling implementations. specifically, valid...
Learnt from: samtholiya
PR: cloudposse/atmos#914
File: cmd/validate_stacks.go:20-23
Timestamp: 2025-01-09T22:27:25.538Z
Learning: The validate commands in Atmos can have different help handling implementations. Specifically, validate_component.go and validate_stacks.go are designed to handle help requests differently, with validate_stacks.go including positional argument checks while validate_component.go does not.
Applied to files:
internal/exec/utils.go
📚 Learning: in `cmd/cmd_utils.go`, it's acceptable to have hardcoded references to `atmos.yaml` in logs, and it'...
Learnt from: haitham911
PR: cloudposse/atmos#736
File: pkg/config/const.go:6-6
Timestamp: 2024-10-20T13:12:46.499Z
Learning: In `cmd/cmd_utils.go`, it's acceptable to have hardcoded references to `atmos.yaml` in logs, and it's not necessary to update them to use the `CliConfigFileName` constant.
Applied to files:
internal/exec/utils.gointernal/exec/cli_utils.go
📚 Learning: in the 'atmos' project, when reviewing go code like `pkg/config/config.go`, avoid suggesting file si...
Learnt from: osterman
PR: cloudposse/atmos#808
File: pkg/config/config.go:478-483
Timestamp: 2024-12-02T21:26:32.337Z
Learning: In the 'atmos' project, when reviewing Go code like `pkg/config/config.go`, avoid suggesting file size checks after downloading remote configs if such checks aren't implemented elsewhere in the codebase.
Applied to files:
internal/exec/utils.gointernal/exec/cli_utils.go
📚 Learning: in the `processyamlconfigfile` function within `internal/exec/stack_processor_utils.go`, directory t...
Learnt from: osterman
PR: cloudposse/atmos#795
File: internal/exec/stack_processor_utils.go:378-386
Timestamp: 2024-11-19T23:00:45.899Z
Learning: In the `ProcessYAMLConfigFile` function within `internal/exec/stack_processor_utils.go`, directory traversal in stack imports is acceptable and should not be restricted.
Applied to files:
internal/exec/utils.go
📚 Learning: in `internal/exec/validate_stacks.go`, when downloading the atmos json schema file to the temp direc...
Learnt from: haitham911
PR: cloudposse/atmos#731
File: internal/exec/validate_stacks.go:0-0
Timestamp: 2024-10-20T00:57:53.500Z
Learning: In `internal/exec/validate_stacks.go`, when downloading the Atmos JSON Schema file to the temp directory, the temporary file is overwritten each time, so explicit removal is not necessary.
Applied to files:
internal/exec/utils.go
📚 Learning: the `u.logtrace` function in the `cloudposse/atmos` repository accepts `atmosconfig` as its first pa...
Learnt from: Listener430
PR: cloudposse/atmos#984
File: internal/exec/copy_glob.go:0-0
Timestamp: 2025-02-06T13:38:07.216Z
Learning: The `u.LogTrace` function in the `cloudposse/atmos` repository accepts `atmosConfig` as its first parameter, followed by the message string.
Applied to files:
internal/exec/utils.go
📚 Learning: in `internal/exec/terraform.go`, the workspace cleaning code under both the general execution path a...
Learnt from: aknysh
PR: cloudposse/atmos#759
File: internal/exec/terraform.go:366-368
Timestamp: 2024-11-02T15:35:09.958Z
Learning: In `internal/exec/terraform.go`, the workspace cleaning code under both the general execution path and within the `case "init":` block is intentionally duplicated because the code execution paths are different. The `.terraform/environment` file should be deleted before executing `terraform init` in both scenarios to ensure a clean state.
Applied to files:
internal/exec/utils.go
📚 Learning: when specifying color values in functions like `confirmdeleteterraformlocal` in `internal/exec/terra...
Learnt from: osterman
PR: cloudposse/atmos#727
File: internal/exec/terraform_clean.go:233-235
Timestamp: 2024-10-31T19:25:41.298Z
Learning: When specifying color values in functions like `confirmDeleteTerraformLocal` in `internal/exec/terraform_clean.go`, avoid hardcoding color values. Instead, use predefined color constants or allow customization through configuration settings to improve accessibility and user experience across different terminals and themes.
Applied to files:
internal/exec/utils.go
📚 Learning: in the context of the atmos project, it's acceptable for functions like `execterraformoutput` to rem...
Learnt from: aknysh
PR: cloudposse/atmos#810
File: internal/exec/terraform_utils.go:40-213
Timestamp: 2024-12-03T05:18:49.169Z
Learning: In the context of the Atmos project, it's acceptable for functions like `execTerraformOutput` to remain as single functions if they perform a single purpose, such as retrieving Terraform outputs for a component in a stack, even if the function is lengthy.
Applied to files:
internal/exec/cli_utils.go
📚 Learning: the "executeatmosvalidateschemacmd" function in internal/exec/validate_schema.go has been reviewed a...
Learnt from: samtholiya
PR: cloudposse/atmos#1147
File: internal/exec/validate_schema.go:42-57
Timestamp: 2025-04-11T22:06:46.999Z
Learning: The "ExecuteAtmosValidateSchemaCmd" function in internal/exec/validate_schema.go has been reviewed and confirmed to have acceptable cognitive complexity despite static analysis warnings. The function uses a clean structure with only three if statements for error handling and delegates complex operations to helper methods.
Applied to files:
internal/exec/cli_utils.go
📚 Learning: prefer not to declare variables within 'if' statements in go code....
Learnt from: Cerebrovinny
PR: cloudposse/atmos#729
File: internal/exec/terraform.go:258-264
Timestamp: 2024-10-19T17:42:29.152Z
Learning: Prefer not to declare variables within 'if' statements in Go code.
Applied to files:
internal/exec/cli_utils.go
📚 Learning: in go, functions with a return type must have a return statement in all code paths, even if the code...
Learnt from: samtholiya
PR: cloudposse/atmos#959
File: cmd/cmd_utils.go:601-614
Timestamp: 2025-02-05T00:07:30.191Z
Learning: In Go, functions with a return type must have a return statement in all code paths, even if the code path includes `os.Exit()` which terminates the program. The compiler requires the return statement for type checking.
Applied to files:
internal/exec/cli_utils.go
📚 Learning: in 'cmd/cmd_utils.go', using `os.exit(1)` directly is acceptable in this context, and wrapping it wi...
Learnt from: pkbhowmick
PR: cloudposse/atmos#766
File: cmd/cmd_utils.go:177-178
Timestamp: 2024-11-07T20:16:15.381Z
Learning: In 'cmd/cmd_utils.go', using `os.Exit(1)` directly is acceptable in this context, and wrapping it with deferred cleanup is considered unnecessary.
Applied to files:
internal/exec/cli_utils.go
📚 Learning: when reviewing pointer usage with `evaluateyqexpression`, check if the `atmosconfig` parameter is al...
Learnt from: aknysh
PR: cloudposse/atmos#943
File: internal/exec/describe_config.go:37-37
Timestamp: 2025-01-19T23:13:50.429Z
Learning: When reviewing pointer usage with `EvaluateYqExpression`, check if the `atmosConfig` parameter is already a pointer (e.g., when returned by `InitCliConfig`) to avoid suggesting unnecessary address-of operations.
Applied to files:
internal/exec/cli_utils.go
📚 Learning: applies to cmd/*.go : provide meaningful feedback to users in commands...
Learnt from: CR
PR: cloudposse/atmos#0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-07-01T02:22:25.901Z
Learning: Applies to cmd/*.go : Provide meaningful feedback to users in commands
Applied to files:
internal/exec/cli_utils.go
📚 Learning: commands should use `printerrormarkdownandexit` with empty title and suggestion (`"", err, ""`) for ...
Learnt from: samtholiya
PR: cloudposse/atmos#959
File: cmd/describe_config.go:20-20
Timestamp: 2025-02-03T06:00:11.419Z
Learning: Commands should use `PrintErrorMarkdownAndExit` with empty title and suggestion (`"", err, ""`) for general error handling. Specific titles like "Invalid Usage" or "File Not Found" should only be used for validation or specific error scenarios.
Applied to files:
internal/exec/cli_utils.go
📚 Learning: in the atmos cli go codebase, using `u.logerrorandexit` within completion functions is acceptable be...
Learnt from: aknysh
PR: cloudposse/atmos#820
File: cmd/list_components.go:53-54
Timestamp: 2024-12-05T22:33:40.955Z
Learning: In the Atmos CLI Go codebase, using `u.LogErrorAndExit` within completion functions is acceptable because it logs the error and exits the command execution.
Applied to files:
internal/exec/cli_utils.go
📚 Learning: for the `atmos terraform shell` command in `internal/exec/shell_utils.go`, input validation for the ...
Learnt from: pkbhowmick
PR: cloudposse/atmos#786
File: internal/exec/shell_utils.go:159-162
Timestamp: 2024-11-16T17:30:52.893Z
Learning: For the `atmos terraform shell` command in `internal/exec/shell_utils.go`, input validation for the custom shell prompt is not required, as users will use this as a CLI tool and any issues will impact themselves.
Applied to files:
internal/exec/cli_utils.go
📚 Learning: the atmos cli should fail fast (exit) when encountering configuration errors, including command alia...
Learnt from: samtholiya
PR: cloudposse/atmos#959
File: cmd/cmd_utils.go:121-148
Timestamp: 2025-02-03T05:57:18.407Z
Learning: The Atmos CLI should fail fast (exit) when encountering configuration errors, including command alias configuration issues, to prevent undefined behavior. Use LogErrorAndExit instead of returning errors in such cases.
Applied to files:
internal/exec/cli_utils.go
📚 Learning: in the atmos project, typos or inconsistencies in test snapshot files (such as "terrafrom" instead o...
Learnt from: Listener430
PR: cloudposse/atmos#1149
File: tests/snapshots/TestCLICommands_atmos_vendor_pull_ssh.stderr.golden:7-7
Timestamp: 2025-03-18T12:26:25.329Z
Learning: In the Atmos project, typos or inconsistencies in test snapshot files (such as "terrafrom" instead of "terraform") may be intentional as they capture the exact output of commands and should not be flagged as issues requiring correction.
Applied to files:
internal/exec/cli_utils.go
📚 Learning: for atmos cli help text, angle brackets in command examples and flag descriptions should be escaped ...
Learnt from: samtholiya
PR: cloudposse/atmos#1068
File: tests/snapshots/TestCLICommands_atmos_terraform_help.stdout.golden:59-64
Timestamp: 2025-02-18T13:13:11.497Z
Learning: For Atmos CLI help text, angle brackets in command examples and flag descriptions should be escaped using HTML entities (e.g., `<component>`) rather than converted to backticks or other markdown formatting.
Applied to files:
internal/exec/cli_utils.go
📚 Learning: in the atmos project, continue to flag path traversal issues in code reviews but acknowledge when th...
Learnt from: osterman
PR: cloudposse/atmos#768
File: internal/exec/vendor_utils.go:496-513
Timestamp: 2024-11-22T12:38:33.132Z
Learning: In the Atmos project, continue to flag path traversal issues in code reviews but acknowledge when they are expected and acceptable in specific cases.
Applied to files:
internal/exec/cli_utils.go
📚 Learning: in future commits, the help text for atmos cli commands should be limited to only show component and...
Learnt from: samtholiya
PR: cloudposse/atmos#955
File: tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden:0-0
Timestamp: 2025-01-19T15:49:15.593Z
Learning: In future commits, the help text for Atmos CLI commands should be limited to only show component and stack parameters for commands that actually use them. This applies to the example usage section in command help text.
Applied to files:
internal/exec/cli_utils.go
📚 Learning: for indirect dependencies with license compliance issues in the cloudposse/atmos repository, the tea...
Learnt from: aknysh
PR: cloudposse/atmos#944
File: go.mod:206-206
Timestamp: 2025-01-17T00:18:57.769Z
Learning: For indirect dependencies with license compliance issues in the cloudposse/atmos repository, the team prefers to handle them in follow-up PRs rather than blocking the current changes, as these issues often require deeper investigation of the dependency tree.
Applied to files:
internal/exec/cli_utils.go
📚 Learning: for the cloudposse/atmos repository, changes to template contents should be handled in dedicated prs...
Learnt from: Listener430
PR: cloudposse/atmos#934
File: tests/fixtures/scenarios/docs-generate/README.md.gotmpl:99-118
Timestamp: 2025-01-25T03:51:57.689Z
Learning: For the cloudposse/atmos repository, changes to template contents should be handled in dedicated PRs and are typically considered out of scope for PRs focused on other objectives.
Applied to files:
internal/exec/cli_utils.go
📚 Learning: in the atmos project, a 5-minute timeout in the `execterraformoutput` function is acceptable for ret...
Learnt from: aknysh
PR: cloudposse/atmos#810
File: internal/exec/terraform_utils.go:145-146
Timestamp: 2024-12-03T05:29:07.718Z
Learning: In the Atmos project, a 5-minute timeout in the `execTerraformOutput` function is acceptable for retrieving `terraform output` for a component in a stack.
Applied to files:
internal/exec/cli_utils.go
📚 Learning: the max-columns flag in atmos list commands supports -1 for unlimited width, which bypasses terminal...
Learnt from: osterman
PR: cloudposse/atmos#1036
File: cmd/list_settings.go:46-50
Timestamp: 2025-02-20T13:57:36.326Z
Learning: The max-columns flag in Atmos list commands supports -1 for unlimited width, which bypasses terminal width restrictions and may require horizontal scrolling. The default is 10 columns if not specified.
Applied to files:
internal/exec/cli_utils.go
📚 Learning: in the atmos project, path traversal is acceptable due to its role in automation. do not flag path t...
Learnt from: osterman
PR: cloudposse/atmos#768
File: internal/exec/vendor_utils.go:496-513
Timestamp: 2024-11-19T14:50:16.194Z
Learning: In the Atmos project, path traversal is acceptable due to its role in automation. Do not flag path traversal as an issue in code reviews.
Applied to files:
internal/exec/cli_utils.go
📚 Learning: applies to **/*.go : use viper for managing configuration, environment variables, and flags...
Learnt from: CR
PR: cloudposse/atmos#0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-07-01T02:22:25.901Z
Learning: Applies to **/*.go : Use Viper for managing configuration, environment variables, and flags
Applied to files:
internal/exec/cli_utils.go
📚 Learning: applies to **/*.go : follow the precedence order: flags > environment variables > config file > defa...
Learnt from: CR
PR: cloudposse/atmos#0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-07-01T02:22:25.901Z
Learning: Applies to **/*.go : Follow the precedence order: flags > environment variables > config file > defaults
Applied to files:
internal/exec/cli_utils.go
🪛 GitHub Check: golangci-lint
internal/exec/cli_utils.go
[failure] 62-62:
function-length: maximum number of statements per function exceeded; max 50 but got 59
[failure] 148-148:
cognitive complexity 313 of func processArgsAndFlags is high (> 20)
[failure] 228-228:
add-constant: string literal "=" appears, at least, 4 times, create a named constant for it
[warning] 572-572:
if len(additionalArgsAndFlags) > 1 has complex nested blocks (complexity: 31)
[failure] 612-612:
early-return: if c { ... } else { ... return } can be simplified to if !c { ... return } ...
[failure] 615-615:
do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("command \"%s\" requires an argument", info.SubCommand)"
[failure] 625-625:
do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("invalid empty argument provided")"
[failure] 629-629:
do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("invalid option format: %s", secondArg)"
[failure] 645-645:
Sentence should start with a capital letter
[warning] 650-650:
if args[i] == "-var" && i+1 < len(args) has complex nested blocks (complexity: 7)
[failure] 673-673:
file-length-limit: file length is 588 lines, which exceeds the limit of 500
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Build (windows-latest, windows)
- GitHub Check: Summary
🔇 Additional comments (3)
internal/exec/utils_test.go (1)
12-97: Well-structured table-driven test implementation.The test effectively validates the post-processing logic with good coverage of different scenarios. The individual field assertions provide clear debugging context.
internal/exec/cli_utils_test.go (1)
1-233: Comprehensive test coverage for CLI argument parsing.The test suite provides solid coverage with table-driven tests, error cases, and edge cases. Good separation of concerns between different test functions.
internal/exec/cli_utils.go (1)
18-59: Good documentation for common flags.Clear organization of Atmos-specific flags that need filtering.
|
These changes were released in v1.185.0. |
what
atmos terraform plancommand--skip-planfileflag toatmos terraform plancommandATMOS_COMPONENTS_TERRAFORM_PLAN_SKIP_PLANFILEENV variablecomponents.terraform.plan.skip_planfilesection toatmos.yamlwhy
Support Terraform Cloud
Allow skipping writing the plan to a file by not passing the
-outflag to Terraform when executing theatmos terraform plancommand. Set the flag totruewhen using Terraform Cloud since the-outflag is not supported. Terraform Cloud automatically stores plans in its backend"Allow controlling the behavior in three ways:
Globally by setting
components.terraform.plan.skip_planfiletotrueinatmos.yamlVia the
ATMOS_COMPONENTS_TERRAFORM_PLAN_SKIP_PLANFILEENV variableBy passing the
--skip-planfile=trueflag on the command lineSummary by CodeRabbit
New Features
--skip-planfileflag to theterraform plancommand to skip writing the plan output to a file, supporting Terraform Cloud workflows.components.terraform.plan.skip_planfileconfiguration option, configurable via CLI flag or environment variable.--init-pass-varsflag to pass generated varfiles toterraform init.Bug Fixes
Documentation
skip_planfileoption and environment variable.Chores
Tests
skip-planfileflag and related configuration handling.