terraform: Eval module call arguments for import #25890
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Include the import walk in the list of operations for which we create an
EvalModuleCallArgument
node. This causes module call arguments to be evaluated even if the module variables have defaults, ensuring that invalid default values (such as the common{}
for variables thought of as maps) do not cause failures specific to import.This fixes a bug where a child module evaluates an input variable in its locals block, assuming that it is a nested object structure. The bug report includes a default value of
{}
, which is overridden by a root variable value. Without the eval node added in this commit, the default value is used and the local evaluation errors.Note: I'm surprised that we weren't evaluating module call arguments for imports, as that seems like it would break import for module expansion in many cases. Is this intentional, and will this change therefore break something else?
Fixes #25888; see reproduction here.