aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/github.com/hashicorp/terraform/lang/eval.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/hashicorp/terraform/lang/eval.go')
-rw-r--r--vendor/github.com/hashicorp/terraform/lang/eval.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/terraform/lang/eval.go b/vendor/github.com/hashicorp/terraform/lang/eval.go
index a3fb363..a8fe8b6 100644
--- a/vendor/github.com/hashicorp/terraform/lang/eval.go
+++ b/vendor/github.com/hashicorp/terraform/lang/eval.go
@@ -203,6 +203,7 @@ func (s *Scope) evalContext(refs []*addrs.Reference, selfAddr addrs.Referenceabl
203 pathAttrs := map[string]cty.Value{} 203 pathAttrs := map[string]cty.Value{}
204 terraformAttrs := map[string]cty.Value{} 204 terraformAttrs := map[string]cty.Value{}
205 countAttrs := map[string]cty.Value{} 205 countAttrs := map[string]cty.Value{}
206 forEachAttrs := map[string]cty.Value{}
206 var self cty.Value 207 var self cty.Value
207 208
208 for _, ref := range refs { 209 for _, ref := range refs {
@@ -334,6 +335,14 @@ func (s *Scope) evalContext(refs []*addrs.Reference, selfAddr addrs.Referenceabl
334 self = val 335 self = val
335 } 336 }
336 337
338 case addrs.ForEachAttr:
339 val, valDiags := normalizeRefValue(s.Data.GetForEachAttr(subj, rng))
340 diags = diags.Append(valDiags)
341 forEachAttrs[subj.Name] = val
342 if isSelf {
343 self = val
344 }
345
337 default: 346 default:
338 // Should never happen 347 // Should never happen
339 panic(fmt.Errorf("Scope.buildEvalContext cannot handle address type %T", rawSubj)) 348 panic(fmt.Errorf("Scope.buildEvalContext cannot handle address type %T", rawSubj))
@@ -350,6 +359,7 @@ func (s *Scope) evalContext(refs []*addrs.Reference, selfAddr addrs.Referenceabl
350 vals["path"] = cty.ObjectVal(pathAttrs) 359 vals["path"] = cty.ObjectVal(pathAttrs)
351 vals["terraform"] = cty.ObjectVal(terraformAttrs) 360 vals["terraform"] = cty.ObjectVal(terraformAttrs)
352 vals["count"] = cty.ObjectVal(countAttrs) 361 vals["count"] = cty.ObjectVal(countAttrs)
362 vals["each"] = cty.ObjectVal(forEachAttrs)
353 if self != cty.NilVal { 363 if self != cty.NilVal {
354 vals["self"] = self 364 vals["self"] = self
355 } 365 }