diff options
Diffstat (limited to 'vendor/github.com/hashicorp/terraform/terraform/eval_read_data.go')
-rw-r--r-- | vendor/github.com/hashicorp/terraform/terraform/eval_read_data.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval_read_data.go b/vendor/github.com/hashicorp/terraform/terraform/eval_read_data.go index 34f2d60..4999480 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_read_data.go +++ b/vendor/github.com/hashicorp/terraform/terraform/eval_read_data.go | |||
@@ -95,7 +95,8 @@ func (n *EvalReadData) Eval(ctx EvalContext) (interface{}, error) { | |||
95 | objTy := schema.ImpliedType() | 95 | objTy := schema.ImpliedType() |
96 | priorVal := cty.NullVal(objTy) // for data resources, prior is always null because we start fresh every time | 96 | priorVal := cty.NullVal(objTy) // for data resources, prior is always null because we start fresh every time |
97 | 97 | ||
98 | keyData := EvalDataForInstanceKey(n.Addr.Key) | 98 | forEach, _ := evaluateResourceForEachExpression(n.Config.ForEach, ctx) |
99 | keyData := EvalDataForInstanceKey(n.Addr.Key, forEach) | ||
99 | 100 | ||
100 | var configDiags tfdiags.Diagnostics | 101 | var configDiags tfdiags.Diagnostics |
101 | configVal, _, configDiags = ctx.EvaluateBlock(config.Config, schema, nil, keyData) | 102 | configVal, _, configDiags = ctx.EvaluateBlock(config.Config, schema, nil, keyData) |
@@ -179,6 +180,17 @@ func (n *EvalReadData) Eval(ctx EvalContext) (interface{}, error) { | |||
179 | ) | 180 | ) |
180 | } | 181 | } |
181 | 182 | ||
183 | log.Printf("[TRACE] Re-validating config for %s", absAddr) | ||
184 | validateResp := provider.ValidateDataSourceConfig( | ||
185 | providers.ValidateDataSourceConfigRequest{ | ||
186 | TypeName: n.Addr.Resource.Type, | ||
187 | Config: configVal, | ||
188 | }, | ||
189 | ) | ||
190 | if validateResp.Diagnostics.HasErrors() { | ||
191 | return nil, validateResp.Diagnostics.InConfigBody(n.Config.Config).Err() | ||
192 | } | ||
193 | |||
182 | // If we get down here then our configuration is complete and we're read | 194 | // If we get down here then our configuration is complete and we're read |
183 | // to actually call the provider to read the data. | 195 | // to actually call the provider to read the data. |
184 | log.Printf("[TRACE] EvalReadData: %s configuration is complete, so reading from provider", absAddr) | 196 | log.Printf("[TRACE] EvalReadData: %s configuration is complete, so reading from provider", absAddr) |