Transit Gateway Peering Attachment Module
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
Name | Version |
---|---|
terraform | >= 1.0.0 |
aws | >= 4.5.0 |
Providers
Name | Version |
---|---|
aws | >= 4.5.0 |
Modules
No modules.
Resources
Name | Type |
---|---|
aws_ec2_transit_gateway_peering_attachment.this | resource |
Inputs
Name | Description | Type | Default | Required |
---|---|---|---|---|
custom_tags | 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. | map(string) | {} | no |
name | The name of the transit gateway peering attachment. If not set, a default name will be used. | string | null | no |
peer_account_id | 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. | string | null | no |
peer_region | The AWS region where the peer transit gateway resides. | string | n/a | yes |
peer_transit_gateway_id | The ID of the peer transit gateway. | string | n/a | yes |
transit_gateway_id | The ID of the transit gateway. This should be your transit gateway. | string | n/a | yes |
Outputs
Name | Description |
---|---|
id | Transit Gateway Peering Attachment identifier |
Sample Usage
- Terraform
- Terragrunt
# ------------------------------------------------------------------------------------------------------
# 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
}
# ------------------------------------------------------------------------------------------------------
# DEPLOY GRUNTWORK'S TRANSIT-GATEWAY-PEERING-ATTACHMENT MODULE
# ------------------------------------------------------------------------------------------------------
terraform {
source = "git::git@github.com:gruntwork-io/terraform-aws-vpc.git//modules/transit-gateway-peering-attachment?ref=v0.27.0"
}
inputs = {
# ----------------------------------------------------------------------------------------------------
# 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
- Inputs
- Outputs
Required
peer_region
stringThe AWS region where the peer transit gateway resides.
peer_transit_gateway_id
stringThe ID of the peer transit gateway.
transit_gateway_id
stringThe ID of the transit gateway. This should be your transit gateway.
Optional
custom_tags
map(string)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.
{}
name
stringThe name of the transit gateway peering attachment. If not set, a default name will be used.
null
peer_account_id
stringThe 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
Transit Gateway Peering Attachment identifier