cloudposse / terraform-aws-vpc-peering

Terraform module to create a peering connection between two VPCs in the same AWS account.

Home Page:https://cloudposse.com/accelerate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

does it work for cross region vpc in the same account?

mohnishbasha opened this issue · comments

Describe the Bug

Running into the following error I am using the module to establish a vpc peering connection between 2 vpcs in different regions but in the same account.

module.requestor_subnets_additional.aws_network_acl_rule.private4_ingress[0]: Refreshing state... [id=nacl-2709026851]

Planning failed. Terraform encountered an error while generating this plan.


│ Error: no matching EC2 VPC found

│ with module.vpc_peering.data.aws_vpc.acceptor[0],
│ on ../../main.tf line 33, in data "aws_vpc" "acceptor":
│ 33: data "aws_vpc" "acceptor" {

Expected Behavior

The module should be able to establish a vpc peering connection for vpcs in different regions.

Steps to Reproduce

  • #51
  • Note: In the PR above, acceptor region is being provisioned in us-east-1, instead of the same region as requestor vpc.
- terraform init.
- terraform apply -var-file=fixtures.us-east-2.tfvars -target=module.requestor_vpc
- terraform apply -var-file=fixtures.us-east-2.tfvars -target=module.requestor_subnets
- terraform apply -var-file=fixtures.us-east-2.tfvars -target=module.requestor_subnets_additional
- terraform apply -var-file=fixtures.us-east-2.tfvars -target=module.acceptor_vpc
- terraform apply -var-file=fixtures.us-east-2.tfvars -target=module.acceptor_subnets
- terraform apply -var-file=fixtures.us-east-2.tfvars -target=module.vpc_peering

Error:

╷
│ Error: no matching EC2 VPC found
│ 
│   with module.vpc_peering.data.aws_vpc.acceptor[0],
│   on ../../main.tf line 33, in data "aws_vpc" "acceptor":
│   33: data "aws_vpc" "acceptor" {
│ 
╵

Screenshots

No response

Environment

  • OS: macOSX
  • version: 11.4
  • Terraform version: 1.5.0

Additional Context

No response