简体   繁体   中英

modify existing AWS VPC using terraform

I want to modify existing VPC by removing the black holed routetabes and update it with new route tables - the routetables i want to modify are created manually (not by the terraform). is that possible in terraform? any sample templates i can refer? Many Thanks, Deepak

If you have existing infrastructure in AWS and you want to manage it with Terraform, you need to use the Terraform import command.

First, write the Terraform code that matches the route tables you already have. For example:

resource "aws_route_table" "example" {
  vpc_id = "${aws_vpc.main.id}"
}

Next, look up the route table ID of the existing route table, and use the import command to have Terraform link the Terraform code above to that existing table:

terraform import aws_route_table.example rtb-12345678

You can also try out a tool like Terraforming which can generate the code and import the state automatically.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM