Skip to content

isaaguilar/terraform-aws-multi-account-peering

Repository files navigation

Terraform AWS multi-account VPC peering module

Set up a peering connection, auto accept, and add to route tables. The request can be same account or between two different accounts.

Usage

provider "aws" {
  region = "us-west-2"
  profile = "account-a"
}

module "multi-account-peering" {
  source  = "isaaguilar/multi-account-peering/aws"
  version = "0.1.0"

  auto_accept_peering   = true
  name                  = "peering-example"

  # Requester Data
  this_vpc_id           = "vpc-dac1daaf"
  this_cidr_block       = "10.0.0.0/24"
  this_route_table_ids  = [ "rtb-05d22c6d", "rtb-17c51a6f" ]  # Set [] to skip

  # Accepter Data
  peer_region           = "us-east-1"
  peer_profile          = "account-b"
  peer_vpc_id           = "vpc-acc6bcff"
  peer_cidr_block       = "10.0.1.0/24"
  peer_route_table_ids  = []

  tags = {
    ManagedWith = "terraform"
    Owner = "Isa Aguilar"
  }
}

Requirements

Name Version
terraform >= 0.12

Providers

Name Version
aws n/a
aws.peer n/a

Modules

No modules.

Resources

Name Type
aws_route.peer_route_tables resource
aws_route.route_tables resource
aws_vpc_peering_connection.this resource
aws_vpc_peering_connection_accepter.peer resource
aws_caller_identity.peer data source
aws_region.peer data source

Inputs

Name Description Type Default Required
auto_accept_peering Whether to auto-accept the peering request bool true no
name Name of the peering connection any n/a yes
peer_cidr_block CIDR block of the peer any n/a yes
peer_profile Profile of the peer any n/a yes
peer_region Region of the peer any n/a yes
peer_route_table_ids Route table IDs of the peer list(any) [] no
peer_vpc_id VPC ID of the peer any n/a yes
tags Tags to apply map(string) n/a yes
this_cidr_block CIDR block of the requestor any n/a yes
this_route_table_ids Route table IDs of the requestor list(any) [] no
this_vpc_id VPC ID of the requestor any n/a yes

Outputs

No outputs.

About

Set up a peering connection, auto accept, and add to route tables

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages