Repository navigation
Fix const variable interpolation in Terraform module sources - #2914
Conversation
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds regression fixtures and execution tests for static ChangesConst module source support
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/exec/const_module_source_test.go`:
- Around line 59-60: Add an assertion in the test around the existing
require.Error and assert.ErrorIs calls to verify the returned error includes the
malformed HCL block diagnostic text, following the assertion pattern used in
hcl_syntax_error_test.go. Keep the wrapper error assertion and ensure the test
still distinguishes genuine syntax errors.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 88fe6858-4bcb-418e-892b-2dd92c5dcb00
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (9)
docs/fixes/2026-08-10-const-module-source-interpolation.mdgo.modinternal/exec/const_module_source_test.gointernal/exec/opentofu_module_source_interpolation_test.gotests/fixtures/scenarios/const-module-source/atmos.yamltests/fixtures/scenarios/const-module-source/components/terraform/broken-variable/main.tftests/fixtures/scenarios/const-module-source/components/terraform/testme/main.tftests/fixtures/scenarios/const-module-source/components/terraform/testme/mods/acme/main.tftests/fixtures/scenarios/const-module-source/stacks/test-stack.yaml
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2914 +/- ##
==========================================
- Coverage 82.99% 82.97% -0.02%
==========================================
Files 1881 1881
Lines 183067 183067
==========================================
- Hits 151937 151906 -31
- Misses 23308 23335 +27
- Partials 7822 7826 +4
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Head branch was pushed to by a user without write access
04349e5
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Head branch was pushed to by a user without write access
6231d32 to
fd88b8f
Compare
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
|
These changes were released in v1.226.0-rc.7. |
What
Updates
terraform-config-inspectto support static (const = true) variableinterpolation in Terraform
module.sourcevalues.Adds regression coverage for:
source = "./mods/${var.org}".*tfconfig.Modulein the OpenTofuinterpolation test.
Why
Atmos previously failed while parsing valid Terraform 1.15+
configurations that interpolate a static variable in
module.source:The previous terraform-config-inspect version evaluated module.source without an HCL
evaluation context and returned Variables not allowed before Terraform or OpenTofu was
invoked.
Fixes: #2913