Interview Prep/Terraform/Repository Structure, Environments and Module Strategy

How do you build cross-account networking such as Transit Gateway attachments with Terraform?

AdvancedProductionRepository Structure, Environments and Module Strategy
Answer

Use two provider configurations (hub and spoke accounts) passed into a module via providers. The spoke creates the attachment request, the hub accepts it (aws_ec2_transit_gateway_vpc_attachment_accepter) and adds routes. Keep RAM sharing of the TGW and cross-account IAM in the foundation stack, and apply in the right order since the hub change depends on the spoke's attachment ID.

All Terraform questions Roadmap: Terraform in production

More on Repository Structure, Environments and Module Strategy