-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(misconf): improve Terraform scanning logging #7133
Conversation
Signed-off-by: nikpivkin <[email protected]>
@@ -296,6 +307,8 @@ func (e *evaluator) expandBlockForEaches(blocks terraform.Blocks, isDynamic bool | |||
forEachVal := forEachAttr.Value() | |||
|
|||
if forEachVal.IsNull() || !forEachVal.IsKnown() || !forEachAttr.IsIterable() { | |||
e.debug.Log(`Failed to expand block %q. Invalid "for-each" argument: %s. Must be known and iterable.`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to this, should we also do a further check to make sure that the terraform configuration we just parsed, is valid? This is in reference to #7099 (comment)
In the above case, I think we should we also log the fact that we purposely ignored an invalid terraform configuration file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by valid configuration? Syntactically or valid for evaluation? In the first case we return an error, in the second case I think the notion of invalid does not fit here, rather incomplete. We may lack some data to evaluate individual blocks and dependencies, not the whole configuration. This can happen mostly because of missing input data or using data blocks or resources that are not static (e.g. random provider).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by valid configuration?
I meant this case: #7099 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added logging if the user has not set the variable 1febd97
Closed in favour of #7295 |
Description
Removed noisy messages. Some messages have been added and changed:
Also removed duplicate time from the message.
Before:
After:
Related Issues:
Checklist