command/show (-json): fix panic if a moduleCall has a nil config#21569
command/show (-json): fix panic if a moduleCall has a nil config#21569mildwonkey merged 2 commits intomasterfrom
Conversation
In the unlikely event that a moduleCall has a nil config - for example, if a nested module call includes a variable with a typo in an attribute - continue gracefully.
pselle
left a comment
There was a problem hiding this comment.
Makes sense to me! Comment on a comment that might have some room to be clearer to future-us
| } | ||
|
|
||
| func marshalModuleCall(c *configs.Config, mc *configs.ModuleCall, schemas *terraform.Schemas) moduleCall { | ||
| // It's possible, though unlikely, to have a module call with a nil config |
There was a problem hiding this comment.
The issue reference here requires a bit of context loading; I think you can say this directly rather than adding a judgement (the "It's possible, though unlikely" -- what does that comment add?), that a nil config can result from a nested module with a mis-formatted config (if that statement is correct)
There was a problem hiding this comment.
The comment is not a judgement so much as a warning meant to emphasize that this is not a normal case, and indeed we may end up fixing the root cause. It's loosely following pattern I see in similar "this doesn't happen often" terraform comments. I will re-word this.
… not happen" If #21543 is fixed, we can remove this check.
One of the show json command tests expected no error when presented with an invalid configuration in a nested module. Modify the test created in PR #21569 so that it can still verify there is no panic, but now expect an error from init.
One of the show json command tests expected no error when presented with an invalid configuration in a nested module. Modify the test created in PR #21569 so that it can still verify there is no panic, but now expect an error from init.
|
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. |
In the unlikely event that a moduleCall has a nil config - for example,
if a nested module call includes a variable with a typo in an
attribute - continue gracefully.
I am concerned that there are repercussions for sentinel users, so I've opened #21568 to capture the root cause.
Fixes #21543