Skip to main content
VPC Modules 0.27.0Last updated in version 0.27.0

Transit Gateway Peering Attachment Module

View Source Release Notes

This Terraform Module creates transit gateway peering resources for the requester side of the connection to another transit gateway. The transit gateway can be in this account or in another account. Transit gateway peering is a one-to-one relationship between two transit gateways. If you need to peer multiple transit gateways, you will need to create multiple transit gateway peering attachments.

See VPC Core Concepts for more information on the core networking components and topologies.

What is a Transit Gateway Peering Attachment?

A transit gateway peering attachment is a way to connect two transit gateways to each other. Much like the VPC attachment, this can be thought of as a network cable. By attaching them, you 'plug' the two transit gateways together. This allows you to route traffic between the two transit gateways. Unlike VPC attachments, peering attachments have two components to the attachment a requester and an accepter. This is important because each attachment must be accepted prior to the attachment being completed. This is a security measure to ensure a malicious attachment from a random account does not gain network access to your environment.

Usage

For usage examples, check out the examples folder.

Requirements

NameVersion
terraform>= 1.0.0
aws>= 4.5.0

Providers

NameVersion
aws>= 4.5.0

Modules

No modules.

Resources

NameType
aws_ec2_transit_gateway_peering_attachment.thisresource

Inputs

NameDescriptionTypeDefaultRequired
custom_tagsA map of tags to apply to all resources when applicable. The key is the tag name and the value is the tag value. Note that the tag 'Name' is automatically added by this module but may be optionally overwritten by this variable.map(string){}no
nameThe name of the transit gateway peering attachment. If not set, a default name will be used.stringnullno
peer_account_idThe AWS account ID of the peer transit gateway. This is only required when the peer transit gateway is owned by a different AWS account. Defaults to the current account ID.stringnullno
peer_regionThe AWS region where the peer transit gateway resides.stringn/ayes
peer_transit_gateway_idThe ID of the peer transit gateway.stringn/ayes
transit_gateway_idThe ID of the transit gateway. This should be your transit gateway.stringn/ayes

Outputs

NameDescription
idTransit Gateway Peering Attachment identifier

Sample Usage

main.tf

# ------------------------------------------------------------------------------------------------------
# DEPLOY GRUNTWORK'S TRANSIT-GATEWAY-PEERING-ATTACHMENT MODULE
# ------------------------------------------------------------------------------------------------------

module "transit_gateway_peering_attachment" {

source = "git::git@github.com:gruntwork-io/terraform-aws-vpc.git//modules/transit-gateway-peering-attachment?ref=v0.27.0"

# ----------------------------------------------------------------------------------------------------
# REQUIRED VARIABLES
# ----------------------------------------------------------------------------------------------------

# The AWS region where the peer transit gateway resides.
peer_region = <string>

# The ID of the peer transit gateway.
peer_transit_gateway_id = <string>

# The ID of the transit gateway. This should be your transit gateway.
transit_gateway_id = <string>

# ----------------------------------------------------------------------------------------------------
# OPTIONAL VARIABLES
# ----------------------------------------------------------------------------------------------------

# A map of tags to apply to all resources when applicable. The key is the tag
# name and the value is the tag value. Note that the tag 'Name' is
# automatically added by this module but may be optionally overwritten by this
# variable.
custom_tags = {}

# The name of the transit gateway peering attachment. If not set, a default
# name will be used.
name = null

# The AWS account ID of the peer transit gateway. This is only required when
# the peer transit gateway is owned by a different AWS account. Defaults to
# the current account ID.
peer_account_id = null

}


Reference

Required

peer_regionstringrequired

The AWS region where the peer transit gateway resides.

The ID of the peer transit gateway.

transit_gateway_idstringrequired

The ID of the transit gateway. This should be your transit gateway.

Optional

custom_tagsmap(string)optional

A map of tags to apply to all resources when applicable. The key is the tag name and the value is the tag value. Note that the tag 'Name' is automatically added by this module but may be optionally overwritten by this variable.

{}
namestringoptional

The name of the transit gateway peering attachment. If not set, a default name will be used.

null
peer_account_idstringoptional

The AWS account ID of the peer transit gateway. This is only required when the peer transit gateway is owned by a different AWS account. Defaults to the current account ID.

null