Loading...
Loading...
### Terraform Version ```shell Terraform v1.11.3 on linux_amd64 + provider registry.terraform.io/hashicorp/azurerm v4.25.0 ``` ### Terraform Configuration Files ```terraform terraform { required_providers { azurerm = { source = "hashicorp/azurerm" version = "~> 4" } } } provider "azurerm" { features {} subscription_id = "TEST_SUBSCRIPTION_ID" } variable "acr_ip_allowlist" { type = map(string) default = { "Office" = "1.2.3.4" } } resource "azurerm_container_registry" "shared" { name = "test" resource_group_name = "test-rg" location = "canadaeast" sku = "Premium" public_network_access_enabled = false network_rule_set { default_action = "Deny" dynamic "ip_rule" { for_each = var.acr_ip_allowlist content { action = "Allow" ip_range = "${ip_rule.value}/32" } } } } ``` ### Debug Output https://gist.github.com/oliver-simwell/60abc7b9e06f9b60ae80493081e7fe79 ### Expected Behavior Should work ### Actual Behavior Error: Unknown variable │ │ on main.tf line 20, in resource "azurerm_container_registry" "acr": │ 20: for_each = var.acr_ip_allowlist │ │ There is no variable named "var". ### Steps to Reproduce 1. terraform init 2. terraform plan: see error However if you now replace the `var.acr_ip_allowlist` by the default value, like this: ``` # for_each = var.acr_ip_allowlist for_each = { "Office" = "1.2.3.4" } ``` and repeat the plan: no error ### Additional Context _No response_ ### References - #35679 ### Generative AI / LLM assisted development? I asked a couple of LLMs about the error, the solutions were as non-sensical as the error.
Click on a version to see all relevant bugs
Terraform Integration
Learn more about where this data comes from
Bug Scrub Advisor
Streamline upgrades with automated vendor bug scrubs
BugZero Enterprise
Wish you caught this bug sooner? Get proactive today.