I am trying to import the existing resources into Terraform state. But I want to automate the import along with a terraform resource creation script.
I am creating a ELB and 2 instances in existing VPC, so first I have to import the existing VPC into my state file by using the name tag of the VPC. But I am seeing the import is working only by using the id key. Is it possible to import using other parameters apart from ID?
不,您不能使用其他标签,必须使用VPC ID导入VPC https://www.terraform.io/docs/providers/aws/r/vpc.html https://www.terraform.io /docs/import/usage.html
You can achieve this using filter field.
eg
data "aws_vpc" "selected" {
filter = "tag:name=value"
}
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.