简体   繁体   中英

AWS import vpc with Terraform

I'm wanted to know if there is possible in Terraform to get the Default VPC ID without need to write the ID or the Name on the manifest and save it on a variable. My idea is to invoke it only knowing that is the Default VPC but not write the ID or Name, just because is the Default VPC.

Thank you

FT

This will get you a reference to the default VPC in the current AWS region:

data "aws_vpc" "default" {
  default = true
}

This is documented here .

Note that this gives you a reference to the VPC, so you can pass the ID to other resources. Terraform does not manage the VPC when you do this, it simply references it. This is different from terraform import which causes Terraform to start managing the VPC, and requires that you pass it the VPC ID.

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