Terraform希望在我添加到一个状态时销毁并创建新资源

Terraform希望在我添加到一个状态时销毁并创建新资源,terraform,Terraform,我正在添加到没有更改的现有状态。我正在添加另一个子网,当我添加它时,它还将创建一个NATGW和一些路由。TF想删除我现有的NATGW ################### # NAT Gateway ################### resource "aws_nat_gateway" "nat_gw" { count = "${length(var.public_subnets)}" allocation_id = "${element(var.eip_allo

我正在添加到没有更改的现有状态。我正在添加另一个子网,当我添加它时,它还将创建一个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))))}"
}
如果我添加更多子网,TF不会删除资源吗


它真的会删除还是会意识到州政府已经有了它们?

您使用的是什么版本的
terraform
<代码>0.11或
0.12
?另外,您能展示一下地形代码的差异吗?您使用的是什么版本的
terraform
<代码>0.11或
0.12
?另外,你能展示一下地形代码的差异吗?
-/+ 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)}"