【发布时间】:2021-08-23 12:25:02
【问题描述】:
我需要一些帮助,我正在尝试为 azure ACI 容器实例编写一个模块。 我发现两个属性是互斥的,dns_name_label 和 network_profile_id。 如果我将ip_address_type设置为public,我想使用dns_name_label,但是network_profile_id不能来同一个脚本 反之亦然,如果我将ip_address_type设置为Private,我必须定义network_profile_id,但是dns_name_label不能来脚本
如果要同时包含 dns_name_label 和 network_profile_id,根据 ip_address_type 判断?
resource "azurerm_container_group" "this" {
name = var.name
location = var.location
resource_group_name = var.resource_group_name
ip_address_type = var.ip_address_type
dns_name_label = var.ip_address_type =="Public"&&length(var.dns_name_label)> 0 ? var.dns_name_label :""
os_type = var.os_type
restart_policy = var.restart_policy
network_profile_id = var.ip_address_type == "Private" ? azurerm_network_profile.this[0].id : ""
}
注意上面的代码不起作用,我得到错误
"network_profile_id": conflicts with dns_name_label
【问题讨论】:
标签: azure terraform terraform-provider-azure