Closed msmagoo87 closed 5 years ago
@msmagoo87
yes, VPC has to be already created for the peering connection to succeed.
we usually create VPC and subnets in a diff project (diff TF folder), then do data source lookup to find the VPC in the peering connection folder.
Or, another way, if all the files are in one TF project, use terraform plan/apply --target ....
to first create the VPC and subnets, and then terraform plan/apply
to provision everything else.
Ah ok, thanks for the confirmation!
Hey there, I am using your terraform-aws-vpc module in combination with this one to create and peer a vpc. I'm having what seems it may be an order of operations issue? Here is my main.tf:
When I run terraform plan I am getting the following error:
My only guess as to what could be happening here is it's failing to get the route table data because the vpc does not yet exist? You'd think it would fail with an aws error rather than an error on the counter though. Hopefully someone might have some insight here.
I was able to get this working by splitting the peering into it's own tf file and running that after this one creates the vpc and passing forward the tfstate file. But ideally I'd like it all to share a tfstate file otherwise if I need to update this file it will wipe out the peering connection configuration.
Thanks