1
我有一个具有许多值(NACL规则)的地图变量。我想添加规则相应如何在terraform中分割地图的值以创建列表?
variable "rules" {
default = {
a = "200,false,tcp,allow,0.0.0.0/0,23,23"
b = "100,true,tcp,allow,0.0.0.0/0,1024,65535"
}
}
resource "aws_network_acl_rule" "bar" {
network_acl_id = "<id>"
rule_number = "${split(",",element(values(var.rules),count.index))[0]}"
egress = "${split(",",element(values(var.rules),count.index))[1]}"
protocol = "${split(",",element(values(var.rules),count.index))[2]}"
rule_action = "${split(",",element(values(var.rules),count.index))[3]}"
cidr_block = "${split(",",element(values(var.rules),count.index))[4]}"
from_port = "${split(",",element(values(var.rules),count.index))[5]}"
to_port = "${split(",",element(values(var.rules),count.index))[6]}"
count = "${length(values(var.rules))}"
}
错误: expected "}" but found "["
由于具有列为值映射不支持,我试图分裂的价值观和迭代