README

tgw-attachment

Attaches a spoke VPC to a Transit Gateway and wires up route propagation and VPC route table entries.

Creates a TGW VPC attachment in the specified subnets, optionally associates and propagates routes to/from a specific TGW route table (falling back to the default), and installs TGW routes in each supplied VPC route table. Run in the spoke account. Depends on the networking/transit-gateway module in the network account for the TGW ID (shared via RAM).

Usage

module "tgw_attachment" {
  source  = "hcassc.jfrog.io/iac-terraform-modules-virtual/networking/tgw-attachment/aws"
  version = "0.1.0"

  name               = "prod-vpc-attachment"
  transit_gateway_id = data.aws_ec2_transit_gateway.core.id
  vpc_id             = module.vpc.id
  subnet_ids         = module.vpc.private_subnet_id_list
  vpc_route_table_ids = values(module.vpc.private_route_table_ids)
}

Requirements

Name Version
terraform ~> 1.5
aws ~> 6.50

Providers

Name Version
aws 6.50.0

Resources

Name Type
aws_ec2_transit_gateway_route_table_association.this resource
aws_ec2_transit_gateway_route_table_propagation.this resource
aws_ec2_transit_gateway_vpc_attachment.this resource
aws_route.tgw resource

Inputs

Name Description Type Default Required
name Name for the TGW attachment string n/a yes
subnet_ids List of subnet IDs (one per AZ) for the TGW attachment ENIs list(string) n/a yes
transit_gateway_id ID of the Transit Gateway to attach to string n/a yes
vpc_id ID of the VPC to attach string n/a yes
appliance_mode_support Enable appliance mode (required for stateful appliances) string "disable" no
dns_support DNS support for the attachment string "enable" no
ipv6_support IPv6 support for the attachment string "disable" no
tags Resource tags to apply to all resources map(string) {} no
transit_gateway_route_table_id TGW route table ID to associate and propagate (optional — uses default when null) string null no
vpc_route_table_ids VPC route table IDs to add TGW routes to list(string) [] no
vpc_tgw_routes Map of CIDR destinations to add as TGW routes in vpc_route_table_ids map(string) { "0.0.0.0/0": "tgw"} no

Outputs

Name Description
arn TGW VPC attachment ARN
id TGW VPC attachment ID