terraform: Eval module call arguments for import#25890
Merged
Conversation
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.
Codecov Report
|
mildwonkey
approved these changes
Aug 18, 2020
Contributor
mildwonkey
left a comment
There was a problem hiding this comment.
This LGTM, and import (MY NEMESIS!!!) being broken kind of feels like its default state, so while we should make sure this doesn't make @jbardin twitch I don't see any cause for concern with this change.
Absolutely perfect and wonderfully helpful test commentary, thank you muchly for that!
jbardin
approved these changes
Aug 18, 2020
|
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
EvalModuleCallArgumentnode. 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.