Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure 地形忽略动态资源的变化_Azure_Terraform - Fatal编程技术网

Azure 地形忽略动态资源的变化

Azure 地形忽略动态资源的变化,azure,terraform,Azure,Terraform,我有一个带有application gateway的TF项目,它有多个动态生成的HTTP侦听器: dynamic "http_listener" { for_each = var.gateway_config iterator = cf content { name = "${cf.value["domain_name"]}-http"

我有一个带有application gateway的TF项目,它有多个动态生成的HTTP侦听器:

 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"]
    }
  }

我想在所有HTTP侦听器的“防火墙策略id”参数上应用忽略更改生命周期

我尝试过的事情:

(...)
      ignore_changes = [
          http_listener[firewall_policy_id],
      ]
这将导致错误-需要单个静态变量

      ignore_changes = [
          http_listener["firewall_policy_id"],
      ]
这根本没用

      ignore_changes = [
          http_listener.*.firewall_policy_id,
      ]
这将返回错误,因为*在此处不正确

目前我唯一的解决方案是添加所有可能的HTTP侦听器(总共200个),但它看起来非常难看,并且占用了代码中的大量空间:

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,
      ]

尝试了一些范围为(200)的列表理解,但再次-错误,Terraform需要在该位置有一个静态值。

我相信您无法使用您希望避免的硬编码元素指定属性。我相信您无法使用您希望避免的硬编码元素指定属性。