Я добавляю в существующее состояние без изменений. Я добавляю другую подсеть, и когда я добавляю ее, она также создает NATGW и некоторые маршруты. TF хочет удалить существующие NATGW, которые у меня есть.
###################
# NAT Gateway
###################
resource "aws_nat_gateway" "nat_gw" {
count = "${length(var.public_subnets)}"
allocation_id = "${element(var.eip_allocation_ids, count.index)}"
subnet_id = "${element(aws_subnet.public.*.id, count.index)}"
tags = "${merge(var.tags, var.public_id_subnet_tags, map("Name", format("%s-nat-gateway-%s", var.name, element(var.azs, count.index))))}"
}
-/+ module.networking.aws_nat_gateway.nat_gw[0] (new resource required)
id: "nat-023d47bfdddfc6389" => <computed> (forces new resource)
allocation_id: "eipalloc-ca1c41f5" => "eipalloc-ca1c41f5"
network_interface_id: "eni-fc7d66e0" => <computed>
private_ip: "172.51.1.127" => <computed>
public_ip: "52.0.0.x" => <computed>
subnet_id: "subnet-e56960bc" => "${element(aws_subnet.public.*.id, count.index)}" (forces new resource)
tags.%: "1" => "1"
tags.Name: "dl-vpce0-nat-gateway-us-east-1a" => "us-east-1a"
-/+ module.networking.aws_nat_gateway.nat_gw[1] (new resource required)
id: "nat-09e0d9274a63e4d9d" => <computed> (forces new resource)
allocation_id: "eipalloc-fbefbdc4" => "eipalloc-fbefbdc4"
network_interface_id: "eni-d70af6ce" => <computed>
private_ip: "172.51.20.35" => <computed>
public_ip: "52.0.0.x" => <computed>
subnet_id: "subnet-69e5121f" => "${element(aws_subnet.public.*.id, count.index)}" (forces new resource)
tags.%: "1" => "1"
tags.Name: "dl-vpce0-nat-gateway-us-east-1d" => "us-east-1d"
-/+ module.networking.aws_nat_gateway.nat_gw[2] (new resource required)
id: "nat-0a7622fe5416aa1ad" => <computed> (forces new resource)
allocation_id: "eipalloc-36f6bd09" => "eipalloc-36f6bd09"
network_interface_id: "eni-757c737a" => <computed>
private_ip: "172.51.51.224" => <computed>
public_ip: "52.0.0.x" => <computed>
subnet_id: "subnet-9dc16ca0" => "${element(aws_subnet.public.*.id, count.index)}" (forces new resource)
tags.%: "1" => "1"
tags.Name: "dl-vpce0-nat-gateway-us-east-1e" => "us-east-1e"
+ module.networking.aws_nat_gateway.nat_gw[3]
id: <computed>
allocation_id: "eipalloc-ca1c41f5"
network_interface_id: <computed>
private_ip: <computed>
public_ip: <computed>
subnet_id: "${element(aws_subnet.public.*.id, count.index)}"
tags.%: "1"
tags.Name: "dl-vpce0-nat-gateway-us-east-1c"
Есть ли способ использовать:
"${element(aws_subnet.public.*.id, count.index)}"
И не TF удалить ресурс, если я добавлю больше подсетей?
Он действительно удалит или поймет, что они уже есть в государстве?