mirror of
https://github.com/hashicorp/terraform.git
synced 2026-02-03 20:50:59 -05:00
Merge 421a188904 into ba5c4ac5e3
This commit is contained in:
commit
d053fdcbbe
3 changed files with 9 additions and 4 deletions
5
.changes/v1.15/BUG FIXES-20251028-104850.yaml
Normal file
5
.changes/v1.15/BUG FIXES-20251028-104850.yaml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
kind: BUG FIXES
|
||||
body: Improve wording of for_each key dependency error when using a set
|
||||
time: 2025-10-28T10:48:50.112437+00:00
|
||||
custom:
|
||||
Issue: ""
|
||||
|
|
@ -221,7 +221,7 @@ func (ev *forEachEvaluator) ensureKnownForResource(forEachVal cty.Value) tfdiags
|
|||
var diags tfdiags.Diagnostics
|
||||
ty := forEachVal.Type()
|
||||
const errInvalidUnknownDetailMap = "The \"for_each\" map includes keys derived from resource attributes that cannot be determined until apply, and so Terraform cannot determine the full set of keys that will identify the instances of this resource.\n\nWhen working with unknown values in for_each, it's better to define the map keys statically in your configuration and place apply-time results only in the map values.\n\nAlternatively, you could use the -target planning option to first apply only the resources that the for_each value depends on, and then apply a second time to fully converge."
|
||||
const errInvalidUnknownDetailSet = "The \"for_each\" set includes values derived from resource attributes that cannot be determined until apply, and so Terraform cannot determine the full set of keys that will identify the instances of this resource.\n\nWhen working with unknown values in for_each, it's better to use a map value where the keys are defined statically in your configuration and where only the values contain apply-time results.\n\nAlternatively, you could use the -target planning option to first apply only the resources that the for_each value depends on, and then apply a second time to fully converge."
|
||||
const errInvalidUnknownDetailSet = "The \"for_each\" set includes elements derived from resource attributes that cannot be determined until apply, and so Terraform cannot determine the full set of keys that will identify the instances of this resource.\n\nWhen working with unknown values in for_each, it's better to use a map value where the map keys are defined statically in your configuration and only the map values contain apply-time results.\n\nAlternatively, you could use the -target planning option to first apply only the resources that the for_each value depends on, and then apply a second time to fully converge."
|
||||
|
||||
if !forEachVal.IsKnown() {
|
||||
var detailMsg string
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ func TestEvaluateForEachExpression_errors(t *testing.T) {
|
|||
"unknown string set": {
|
||||
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",
|
||||
true, false, false,
|
||||
},
|
||||
"unknown map": {
|
||||
|
|
@ -178,13 +178,13 @@ func TestEvaluateForEachExpression_errors(t *testing.T) {
|
|||
"set containing unknown value": {
|
||||
hcltest.MockExprLiteral(cty.SetVal([]cty.Value{cty.UnknownVal(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",
|
||||
true, false, false,
|
||||
},
|
||||
"set containing dynamic unknown value": {
|
||||
hcltest.MockExprLiteral(cty.SetVal([]cty.Value{cty.UnknownVal(cty.DynamicPseudoType)})),
|
||||
"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",
|
||||
true, false, false,
|
||||
},
|
||||
"set containing sensitive values": {
|
||||
|
|
|
|||
Loading…
Reference in a new issue