-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Misleading error message for an incorrect dynamic block iterator #34132
Copy link
Copy link
Closed
Labels
bugconfigconfirmeda Terraform Core team member has reproduced this issuea Terraform Core team member has reproduced this issue
Description
Terraform Version
Terraform v1.6.2
on darwin_arm64
+ provider registry.terraform.io/cloudflare/cloudflare v4.8.0Terraform Configuration Files
terraform {
required_version = ">= 1.5.0"
required_providers {
cloudflare = {
source = "cloudflare/cloudflare"
version = "~> 4.0"
}
}
}
data "cloudflare_zone" "example" {
name = "example.org"
}
locals {
example1_ip_ranges = [
"1.2.3.4/32",
"1.2.3.4/32",
]
example2_ip_ranges = [
"1.2.3.4/32",
"1.2.3.4/32",
]
}
resource "cloudflare_zone_lockdown" "example" {
zone_id = data.cloudflare_zone.example.zone_id
urls = ["https://*.example.org"]
dynamic "configurations" {
for_each = concat(local.example1_ip_ranges, local.example2_ip_ranges)
iterator = "client"
content {
target = "ip_range"
value = client.value
}
}
}Debug Output
n/a
Expected Behavior
It should have told me that "client" was an invalid value for the iterator argument. As soon as I de-quoted it, everything works as expected.
Actual Behavior
╷
│ Error: Insufficient configurations blocks
│
│ on zonelockdown.tf line 13, in resource "cloudflare_zone_lockdown" "example":
│ 13: resource "cloudflare_zone_lockdown" "example" {
│
│ At least 1 "configurations" blocks are required.
╵
╷
│ Error: Unknown variable
│
│ on zonelockdown.tf line 19, in resource "cloudflare_zone_lockdown" "example":
│ 19: for_each = concat(local.example1_ip_ranges, local.example2_ip_ranges)
│
│ There is no variable named "local".
╵
╷
│ Error: Unknown variable
│
│ on zonelockdown.tf line 19, in resource "cloudflare_zone_lockdown" "example":
│ 19: for_each = concat(local.example1_ip_ranges, local.example2_ip_ranges)
│
│ There is no variable named "local".
Steps to Reproduce
terraform validate
Additional Context
No response
References
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugconfigconfirmeda Terraform Core team member has reproduced this issuea Terraform Core team member has reproduced this issue