Skip to content

heap/terraform-aws-vpc-peering

 
 

Repository files navigation

AWS VPC Peering Connection Module

Welcome 👋

SWUbanner

Additional information for users from Russia and Belarus

Glory to Ukraine! 🇺


terraform-aws-vpc-peering

This module configures VPC peering in different configurations.

These types of resources are supported:

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 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 Terraofmr 0.14 and 0.15 at the same time or you're in the process of migration, please, use v3.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 use v4.* versions of this module
  • For Terraform versions >=0.13 use v3.* versions of this module
  • For Terraform versions >=0.12 <0.13 use v2.* versions of this module
  • If you're still using Terraform 0.11, you can use v1.* versions of this module

Usage

Examples

Sample configuration is located in examples directory.

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

Changelog is in the CHANGELOG.md

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

About me

License

Apache 2 Licensed. See LICENSE for full details.

Releases

No releases published

Packages

No packages published

Languages

  • HCL 81.0%
  • Go 19.0%