We have been waiting for the following change > https://github.com/terraform-providers/terraform-provider-azurerm/pull/5440
Now that it is here I am a bit confused on how to implement a dynamic in a child block.
We have a list of ips we would like to add using a dynamic blocks. Terraform itself doesn’t give us a error but the plan shows no changes what so ever.
resource "azurerm_function_app" "app" {
for_each = { for o in local.functions : o.group_key => o }
name = format("%s%s%s", upper(var.full_env_code), "-", each.value.group_key)
location = data.azurerm_resource_group.rg.location
resource_group_name = data.azurerm_resource_group.rg.name
app_service_plan_id = azurerm_app_service_plan.service_plan[each.value.key].id
storage_connection_string = module.storage.primary_connection_string
version = "~2"
site_config {
dynamic "ip_restriction" {
for_each = var.ip_restrictions
content {
ip_address = ip_restriction.key
}
}
}
}
If i swap out
site_config {
dynamic "ip_restriction" {
for_each = var.ip_restrictions
content {
ip_address = ip_restriction.key
}
}
}
and hardcode a ip
site_config {
ip_restriction {
ip_address = "10.0.0.1
}
}
We are able to see the change in a plan
site_config {
always_on = false
ftps_state = "AllAllowed"
http2_enabled = false
~ ip_restriction = [
+ {
+ ip_address = "10.0.0.1"
+ subnet_id = null
},
]
How can we use a dynamic on a child block?