Hi,
I have an existing VPC peer between AWS Account 1 and AWS Account 2 which was created manually. I am now trying to do the same via Terraform between the same accounts but the result seems to put the acceptor/requestor back to front and when i try to switch around the peer_owner_id and peer_vpc_id it then suggests the vpc_id is incorrect. I’ve tried making changes to the syntax but no luck so far.
Currently, I have a working VPC peer which was setup manually. But this is a new AWS account and I need to recreate everything using IAAS via Terraform. I need to replicate the below configuration:
Requester VPC owner = 716270604444
Requester VPC ID = vpc-48947456
Requester VPC Region = London (eu-west-2)
Requester VPC CIDRs = 10.222.0.0/16
VPC Peering Connection = pcx-0ff4f1637e9f9e432
Accepter VPC owner = 874855963333
Accepter VPC ID = vpc-0fe237630b00f9387
Accepter VPC Region = London (eu-west-2)
Accepter VPC CIDRs = 10.240.0.0/16"
Peering connection status = Active
Currently, my terraform .tf file is setup with the below syntax and as mentioned above it does create the peer but back to front:
resource “aws_vpc_peering_connection” “vpc-peer-mgmt” {
peer_owner_id = “874855963333”
peer_vpc_id = “vpc-48947456”
vpc_id = aws_vpc.prod-vpc.id
}
Any advice would be much appreciated.
Thanks.