I have TF project with application gateway, which has multiple dynamically generated HTTP listeners:
dynamic "http_listener" {
for_each = var.gateway_config
iterator = cf
content {
name = "${cf.value["domain_name"]}-http"
frontend_ip_configuration_name = local.frontend_ip_configuration_name
frontend_port_name = local.frontend_http_port_name
protocol = "Http"
host_name = cf.value["domain_name"]
}
}
I'd like to apply ignore_changes lifecycle on all of those HTTP listeners "firewall_policy_id" paremeters.
Things that I've tried:
(...)
ignore_changes = [
http_listener[firewall_policy_id],
]
this ends in error - single static variable is required
ignore_changes = [
http_listener["firewall_policy_id"],
]
this doesn't do anything at all
ignore_changes = [
http_listener.*.firewall_policy_id,
]
this returns error, as * is not correct in this place
My only solution for now is to add all possible HTTP listeners (all 200 of them), but it looks really ugly and takes up way to much space in the code:
ignore_changes = [
http_listener[0].firewall_policy_id,
http_listener[1].firewall_policy_id,
http_listener[2].firewall_policy_id,
...
http_listener[200].firewall_policy_id,
]
Tried with some for list comprehensions with range(200) but again - error, Terraform needs to have a static value in that place.