aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/github.com/hashicorp/terraform/configs/resource.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/hashicorp/terraform/configs/resource.go')
-rw-r--r--vendor/github.com/hashicorp/terraform/configs/resource.go32
1 files changed, 18 insertions, 14 deletions
diff --git a/vendor/github.com/hashicorp/terraform/configs/resource.go b/vendor/github.com/hashicorp/terraform/configs/resource.go
index de1a343..edf822c 100644
--- a/vendor/github.com/hashicorp/terraform/configs/resource.go
+++ b/vendor/github.com/hashicorp/terraform/configs/resource.go
@@ -111,13 +111,15 @@ func decodeResourceBlock(block *hcl.Block) (*Resource, hcl.Diagnostics) {
111 111
112 if attr, exists := content.Attributes["for_each"]; exists { 112 if attr, exists := content.Attributes["for_each"]; exists {
113 r.ForEach = attr.Expr 113 r.ForEach = attr.Expr
114 // We currently parse this, but don't yet do anything with it. 114 // Cannot have count and for_each on the same resource block
115 diags = append(diags, &hcl.Diagnostic{ 115 if r.Count != nil {
116 Severity: hcl.DiagError, 116 diags = append(diags, &hcl.Diagnostic{
117 Summary: "Reserved argument name in resource block", 117 Severity: hcl.DiagError,
118 Detail: fmt.Sprintf("The name %q is reserved for use in a future version of Terraform.", attr.Name), 118 Summary: `Invalid combination of "count" and "for_each"`,
119 Subject: &attr.NameRange, 119 Detail: `The "count" and "for_each" meta-arguments are mutually-exclusive, only one should be used to be explicit about the number of resources to be created.`,
120 }) 120 Subject: &attr.NameRange,
121 })
122 }
121 } 123 }
122 124
123 if attr, exists := content.Attributes["provider"]; exists { 125 if attr, exists := content.Attributes["provider"]; exists {
@@ -300,13 +302,15 @@ func decodeDataBlock(block *hcl.Block) (*Resource, hcl.Diagnostics) {
300 302
301 if attr, exists := content.Attributes["for_each"]; exists { 303 if attr, exists := content.Attributes["for_each"]; exists {
302 r.ForEach = attr.Expr 304 r.ForEach = attr.Expr
303 // We currently parse this, but don't yet do anything with it. 305 // Cannot have count and for_each on the same data block
304 diags = append(diags, &hcl.Diagnostic{ 306 if r.Count != nil {
305 Severity: hcl.DiagError, 307 diags = append(diags, &hcl.Diagnostic{
306 Summary: "Reserved argument name in module block", 308 Severity: hcl.DiagError,
307 Detail: fmt.Sprintf("The name %q is reserved for use in a future version of Terraform.", attr.Name), 309 Summary: `Invalid combination of "count" and "for_each"`,
308 Subject: &attr.NameRange, 310 Detail: `The "count" and "for_each" meta-arguments are mutually-exclusive, only one should be used to be explicit about the number of resources to be created.`,
309 }) 311 Subject: &attr.NameRange,
312 })
313 }
310 } 314 }
311 315
312 if attr, exists := content.Attributes["provider"]; exists { 316 if attr, exists := content.Attributes["provider"]; exists {