![](/img/trans.png)
[英]Terraform error when trying to get count.index from var, error [count.index is 3 local.metric_names is object with 4 attributes]
[英]Terraform - Count.index and String together
如何將count.index + 1
附加到字符串? "Subnet-"count.index+1
似乎不起作用。 我什至嘗試在它周圍引用引號,但仍然不起作用。
resource "aws_subnet" "subnets" {
count = length(var.azs)
vpc_id = aws_vpc.main.id
cidr_block = element(var.subnet_cidr, count.index)
tags = {
Name = "Subnet-"count.index+1
}
}
您可以引用所有內容:
tags = {
Name = "Subnet-${count.index+1}"
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.