Repository navigation
fix: Ensure terraform plan-diff processes yaml and skips init properly - #2305
Conversation
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
cmd/terraform/plan_diff.go (1)
65-67:⚠️ Potential issue | 🟠 MajorGlobal config-selection flags can still be ignored at config init.
At Line 66,
cfg.InitCliConfig(schema.ConfigAndStacksInfo{}, true)passes an empty struct, which can drop--base-path,--config,--config-path, and--profileselection for this command. Parse global flags first and pass them intoInitCliConfig.Suggested fix.
- // Initialize Atmos configuration - atmosConfig, err := cfg.InitCliConfig(schema.ConfigAndStacksInfo{}, true) + // Initialize Atmos configuration with global CLI selection flags. + globalInfo := flags.ParseGlobalFlags(cmd, v) + atmosConfig, err := cfg.InitCliConfig(globalInfo, true) if err != nil { return err }Based on learnings: “when initializing CLI config via cfg.InitCliConfig, always first populate ConfigAndStacksInfo with global flag values using flags.ParseGlobalFlags(cmd, v); otherwise --base-path/--config/--config-path/--profile can be ignored.”
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@cmd/terraform/plan_diff.go` around lines 65 - 67, The CLI initializes Atmos config with an empty schema.ConfigAndStacksInfo which can ignore global flags; before calling cfg.InitCliConfig in plan_diff.go, parse and populate global flag values into a ConfigAndStacksInfo instance by calling flags.ParseGlobalFlags(cmd, v) (or equivalent) and pass that populated struct into cfg.InitCliConfig(schema.ConfigAndStacksInfo{...}, true); update the code around cfg.InitCliConfig to create a cfgInfo variable, call flags.ParseGlobalFlags to fill it, then pass cfgInfo into InitCliConfig so --base-path/--config/--config-path/--profile are honored.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@cmd/terraform/plan_diff.go`:
- Around line 65-67: The CLI initializes Atmos config with an empty
schema.ConfigAndStacksInfo which can ignore global flags; before calling
cfg.InitCliConfig in plan_diff.go, parse and populate global flag values into a
ConfigAndStacksInfo instance by calling flags.ParseGlobalFlags(cmd, v) (or
equivalent) and pass that populated struct into
cfg.InitCliConfig(schema.ConfigAndStacksInfo{...}, true); update the code around
cfg.InitCliConfig to create a cfgInfo variable, call flags.ParseGlobalFlags to
fill it, then pass cfgInfo into InitCliConfig so
--base-path/--config/--config-path/--profile are honored.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: cd10335f-7f5e-466f-8d23-fb9bba8f418d
📒 Files selected for processing (1)
cmd/terraform/plan_diff.go
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2305 +/- ##
==========================================
+ Coverage 77.15% 77.18% +0.02%
==========================================
Files 1069 1069
Lines 101313 101317 +4
==========================================
+ Hits 78169 78198 +29
+ Misses 18834 18809 -25
Partials 4310 4310
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Andriy Knysh (aknysh)
left a comment
There was a problem hiding this comment.
thanks Jon Howard (@jhoward-rula)
|
These changes were released in v1.215.0-rc.5. |
what
atmos terraform plan-diffwould not properly process templates, functions, or respect the--skip-initflag.why
references
Summary by CodeRabbit
plan-diffcommand now accepts additional configuration options for controlling Terraform template processing, function execution, and initialization behavior during plan operations.