diff options
Diffstat (limited to 'vendor/github.com/hashicorp/terraform/terraform/eval_state.go')
-rw-r--r-- | vendor/github.com/hashicorp/terraform/terraform/eval_state.go | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval_state.go b/vendor/github.com/hashicorp/terraform/terraform/eval_state.go index d506ce3..b611113 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_state.go +++ b/vendor/github.com/hashicorp/terraform/terraform/eval_state.go | |||
@@ -424,15 +424,21 @@ func (n *EvalWriteResourceState) Eval(ctx EvalContext) (interface{}, error) { | |||
424 | return nil, diags.Err() | 424 | return nil, diags.Err() |
425 | } | 425 | } |
426 | 426 | ||
427 | // Currently we ony support NoEach and EachList, because for_each support | ||
428 | // is not fully wired up across Terraform. Once for_each support is added, | ||
429 | // we'll need to handle that here too, setting states.EachMap if the | ||
430 | // assigned expression is a map. | ||
431 | eachMode := states.NoEach | 427 | eachMode := states.NoEach |
432 | if count >= 0 { // -1 signals "count not set" | 428 | if count >= 0 { // -1 signals "count not set" |
433 | eachMode = states.EachList | 429 | eachMode = states.EachList |
434 | } | 430 | } |
435 | 431 | ||
432 | forEach, forEachDiags := evaluateResourceForEachExpression(n.Config.ForEach, ctx) | ||
433 | diags = diags.Append(forEachDiags) | ||
434 | if forEachDiags.HasErrors() { | ||
435 | return nil, diags.Err() | ||
436 | } | ||
437 | |||
438 | if forEach != nil { | ||
439 | eachMode = states.EachMap | ||
440 | } | ||
441 | |||
436 | // This method takes care of all of the business logic of updating this | 442 | // This method takes care of all of the business logic of updating this |
437 | // while ensuring that any existing instances are preserved, etc. | 443 | // while ensuring that any existing instances are preserved, etc. |
438 | state.SetResourceMeta(absAddr, eachMode, n.ProviderAddr) | 444 | state.SetResourceMeta(absAddr, eachMode, n.ProviderAddr) |