Skip to content

Peer VPCs across AWS Accounts and Regions - #71

Open
Eric Thompson (ethompsy) wants to merge 13 commits into
cloudposse:mainfrom
sonatype:multi_region_and_account
Open

Peer VPCs across AWS Accounts and Regions#71
Eric Thompson (ethompsy) wants to merge 13 commits into
cloudposse:mainfrom
sonatype:multi_region_and_account

Conversation

@ethompsy

Copy link
Copy Markdown

what

  • Split the module between two AWS provider aliases: aws.requestor and aws.acceptor

why

  • This allows peering connections across AWS account and/or regions
  • The same provider can be passed into both arguments to achieve peering within the same AWS account and region

references

Terraform Documentation on Provider Usage:

https://developer.hashicorp.com/terraform/language/modules/develop/providers#:~:text=Provider%20configurations%20can%20be%20defined%20only%20in%20a%20root%20Terraform%20module.

TL;DR: "Provider configurations can be defined only in a root Terraform module."

Deprecates: https://github.com/cloudposse/terraform-aws-vpc-peering-multi-account

-closes #52
-closes #42

@atatevyan

atatevyan commented Feb 26, 2026

Copy link
Copy Markdown

Thanks for this PR. Indeed, there is no point of maintaining two very similar modules for the same purpose.

And I suggest, this module is adjusted to be compatible with the https://github.com/cloudposse/terraform-aws-vpc-peering-multi-account, so that we don't break things when migrating to the one unified module in the future.

Comment thread main.tf
vpc_peering_connection_id = aws_vpc_peering_connection.default[0].id
auto_accept = var.auto_accept

accepter {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using aws_vpc_peering_connection_options resource instead.

Comment thread main.tf
update = var.update_timeout
delete = var.delete_timeout
# Accepter's side of the connection.
resource "aws_vpc_peering_connection_accepter" "default" {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typically, this one won't be needed for the same account/same region case, as it will be treated as the same resource as requester by AWS. For this very reason, the multi-account module exhibits incorrect behavior, trying to rewrite requester tags with accepter tags and vice versa with every next plan/apply cycle, never reaching state convergence. Here, you're using same tags for both requester and accepter, so shouldn't be an issue, however this will break compatibility with multi-account module, if someone tries to migrate from it to this reworked module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage Needs triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants