Terraform module to setup VPC peering connection
APACHE-2.0 License
Glory to Ukraine! 🇺
This module configures VPC peering in different configurations.
These types of resources are supported:
apply
twice.v3.1.*
supports both Terraform 0.14
and 0.15.0
. However, it throws warnings regarding empty providers deprecation. Provider configuration was changed in Terraform 0.15.0
. Therefore, newer versions would likely be incompatible with Terraform <=0.15
. So, if you need to use both Terraform 0.14
and 0.15
at the same time or you're in the process of migration, please, use v3.1.*
of this module.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.
Always make sure you pinned the module version!
>=0.15
use v4.*
versions of this module>=0.13
use v3.*
versions of this module>=0.12 <0.13
use v2.*
versions of this module0.11
, you can use v1.*
versions of this moduleSample configuration is located in examples directory.
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"
}
}
You can also define the peering name as a variable:
module "single_account_single_region" {
source = "../../"
providers = {
aws.this = aws
aws.peer = aws
}
name = "tf-single-account-single-region"
this_vpc_id = var.this_vpc_id
peer_vpc_id = var.peer_vpc_id
auto_accept_peering = true
tags = {
Environment = "Test"
}
}
See the changelog on the GitHub Releases page.
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.
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.
Module managed by Yurii Rochniak
Apache 2 License is applied. See LICENSE for full details.