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
- * - 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 Terraofmr0.14
and0.15
at the same time or you're in the process of migration, please, usev3.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!
- 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
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
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 is in the CHANGELOG.md
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 Licensed. See LICENSE for full details.