aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/github.com/hashicorp/terraform/addrs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/hashicorp/terraform/addrs')
-rw-r--r--vendor/github.com/hashicorp/terraform/addrs/for_each_attr.go12
-rw-r--r--vendor/github.com/hashicorp/terraform/addrs/parse_ref.go8
2 files changed, 20 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/terraform/addrs/for_each_attr.go b/vendor/github.com/hashicorp/terraform/addrs/for_each_attr.go
new file mode 100644
index 0000000..7a63850
--- /dev/null
+++ b/vendor/github.com/hashicorp/terraform/addrs/for_each_attr.go
@@ -0,0 +1,12 @@
1package addrs
2
3// ForEachAttr is the address of an attribute referencing the current "for_each" object in
4// the interpolation scope, addressed using the "each" keyword, ex. "each.key" and "each.value"
5type ForEachAttr struct {
6 referenceable
7 Name string
8}
9
10func (f ForEachAttr) String() string {
11 return "each." + f.Name
12}
diff --git a/vendor/github.com/hashicorp/terraform/addrs/parse_ref.go b/vendor/github.com/hashicorp/terraform/addrs/parse_ref.go
index 84fe8a0..a230d0c 100644
--- a/vendor/github.com/hashicorp/terraform/addrs/parse_ref.go
+++ b/vendor/github.com/hashicorp/terraform/addrs/parse_ref.go
@@ -85,6 +85,14 @@ func parseRef(traversal hcl.Traversal) (*Reference, tfdiags.Diagnostics) {
85 Remaining: remain, 85 Remaining: remain,
86 }, diags 86 }, diags
87 87
88 case "each":
89 name, rng, remain, diags := parseSingleAttrRef(traversal)
90 return &Reference{
91 Subject: ForEachAttr{Name: name},
92 SourceRange: tfdiags.SourceRangeFromHCL(rng),
93 Remaining: remain,
94 }, diags
95
88 case "data": 96 case "data":
89 if len(traversal) < 3 { 97 if len(traversal) < 3 {
90 diags = diags.Append(&hcl.Diagnostic{ 98 diags = diags.Append(&hcl.Diagnostic{