AWS VPC Peering Connection Module
Welcome π
Additional information for users from Russia and Belarus
- Russia has illegally annexed Crimea in 2014 and brought the war in Donbas followed by full-scale invasion of Ukraine in 2022.
- Russia has brought sorrow and devastations to millions of Ukrainians, killed hundreds of innocent people, damaged thousands of buildings, and forced several million people to flee.
- Putin khuylo!
Glory to Ukraine! πΊ
This module configures VPC peering in different configurations.
These types of resources are supported:
- AWS VPC Peering Connection
- AWS VPC Peering Connection Accepter
- AWS VPC Peering Connection Options *
- AWS Route
Important Notice
- * - There is a bug with applying VPC peering options currently. You can still specify and manage them with this module, but you will need to run
apply
twice. - Version
v3.1.*
supports both Terraform0.14
and0.15.0
. However, it throws warnings regarding empty providers deprecation. Provider configuration was changed in Terraform0.15.0
. Therefore, newer versions would likely be incompatible with Terraform<=0.15
. So, if you need to use both Terraform0.14
and0.15
at the same time or you're in the process of migration, please, usev3.1.*
of this module.
Features
This module configures VPC peering between two VPCs. Cross-account and cross-region configurations are supported as well.
You can also manage peering options, but you need to run apply
twice to do that.
Terraform Versions
Always make sure you pinned the module version!
- For Terraform versions
>=0.15
usev4.*
versions of this module - For Terraform versions
>=0.13
usev3.*
versions of this module - For Terraform versions
>=0.12 <0.13
usev2.*
versions of this module - If you're still using Terraform
0.11
, you can usev1.*
versions of this module
Usage
Examples
Sample configuration is located in examples directory.
- Single account, single region peering
- Single account, single region peering with options defined
- Single account, cross region peering
- Cross account, cross region peering
- Using depends_on with this module
Simple Peering (single AWS account, same region)
Notice: You need to declare both providers even with single region peering.
module "single_account_single_region" {
source = "../../"
providers = {
aws.this = aws
aws.peer = aws
}
this_vpc_id = var.this_vpc_id
peer_vpc_id = var.peer_vpc_id
auto_accept_peering = true
tags = {
Name = "tf-single-account-single-region"
Environment = "Test"
}
}
Changelog
See the changelog on the GitHub Releases page.
Contribution
Your contribution to this module is more than welcome!
If you have an idea on how to improve this theme or found a bug feel free to use GitHub issues to let me know.
If you want to contribute to this theme, please, fork this repository and create a pull request. For recent versions of Terraform, open a PR against the master
branch. For Terraform 0.12, please, open a PR against terraform012
branch. For Terraform 0.11, please, open a PR against terraform011
branch.
Testing
This module is tested with Terratest You can find existing tests in the test/ directory.
Tests require AWS credentials. Since GitHub actions don't share the keys with fork repositories (on purpose), don't mind if tests for your PR failed. I will see it anyways and run them on my own. Alternatively, you can always run tests for your forks with your AWS credentials.
Authors
Module managed by Yurii Rochniak
License
Apache 2 License is applied. See LICENSE for full details.