Improve wording of for_each key dependency error when using a set#37824
Closed
LeoCie wants to merge 1 commit intohashicorp:mainfrom
Closed
Improve wording of for_each key dependency error when using a set#37824LeoCie wants to merge 1 commit intohashicorp:mainfrom
LeoCie wants to merge 1 commit intohashicorp:mainfrom
Conversation
jbardin
reviewed
Oct 29, 2025
| hcltest.MockExprLiteral(cty.UnknownVal(cty.Set(cty.String))), | ||
| "Invalid for_each argument", | ||
| "set includes values derived from resource attributes that cannot be determined until apply", | ||
| "set includes elements derived from resource attributes that cannot be determined until apply", |
Member
There was a problem hiding this comment.
The "elements" of a set are the conceptual placeholders for the value (in the implementation, Element() actually returns the key-value pair), but it is still a "value" which is derived from an expression. I see how the wording above is a bit clumsy with the repeated use of "value", but I don't think this is more clear. That could be because I'm used to communicating in Terraform's language, so I wonder if anyone else find this problematic enough to change.
Contributor
|
Given the comment from @jbardin and no further follow-up, I'm going to close this one. Thanks for this submission, I think we would still be open to some manner of clarification of this language. |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The wording of this error is confusing, it mixes the "values" of a set, and the "values" of a map. I have reworded to make it clear what is being talked about - the "elements" of a set, and the "keys/values" of a map.
This change only affects the error messaging, and nothing else.
Target Release
1.15.x
Rollback Plan
Changes to Security Controls
None.
CHANGELOG entry