Skip to content

Instantly share code, notes, and snippets.

@fspijkerman
Created March 16, 2022 11:46
Show Gist options
  • Save fspijkerman/5e6d8c46a94ad0f1033b576362dedf23 to your computer and use it in GitHub Desktop.
Save fspijkerman/5e6d8c46a94ad0f1033b576362dedf23 to your computer and use it in GitHub Desktop.
module "transit_gateway" {
source = "cloudposse/transit-gateway/aws"
version = "0.6.1"
ram_resource_share_enabled = true
create_transit_gateway = true
create_transit_gateway_route_table = true
create_transit_gateway_vpc_attachment = false
create_transit_gateway_route_table_association_and_propagation = true
config = {
shared = {
vpc_id = null
vpc_cidr = null
subnet_ids = null
subnet_route_table_ids = null
route_to = null
route_to_cidr_blocks = null
transit_gateway_vpc_attachment_id = module.transit_gateway_vpc_attachments_and_subnet_routes_shared.transit_gateway_vpc_attachment_ids["shared"]
static_routes = [
{
blackhole = true
destination_cidr_block = "0.0.0.0/0"
},
{
blackhole = false
destination_cidr_block = "172.16.0.0/24"
}
]
},
prod = {
vpc_id = null
vpc_cidr = null
subnet_ids = null
subnet_route_table_ids = null
route_to = null
route_to_cidr_blocks = null
transit_gateway_vpc_attachment_id = module.transit_gateway_vpc_attachments_and_subnet_routes_prod.transit_gateway_vpc_attachment_ids["prod"]
static_routes = [
{
blackhole = false
destination_cidr_block = "172.16.0.0/24"
}
]
},
}
context = module.this.context
providers = {
aws = aws.shared
}
}
module "transit_gateway_vpc_attachments_and_subnet_routes_shared" {
source = "cloudposse/transit-gateway/aws"
version = "0.6.1"
existing_transit_gateway_id = module.transit_gateway.transit_gateway_id
existing_transit_gateway_route_table_id = module.transit_gateway.transit_gateway_route_table_id
create_transit_gateway = false
create_transit_gateway_route_table = false
create_transit_gateway_vpc_attachment = true
create_transit_gateway_route_table_association_and_propagation = false
config = {
shared = {
vpc_id = module.vpc_shared.id
vpc_cidr = module.vpc_shared.cidr_block
subnet_ids = module.vpc_shared.private_subnet_ids
subnet_route_table_ids = module.vpc_shared.private_route_table_ids
route_to = null
route_to_cidr_blocks = [
module.vpc_prod.cidr_block,
]
static_routes = null
transit_gateway_vpc_attachment_id = null
}
}
context = module.this.context
providers = {
aws = aws.shared
}
}
module "transit_gateway_vpc_attachments_and_subnet_routes_prod" {
source = "cloudposse/transit-gateway/aws"
version = "0.6.1"
existing_transit_gateway_id = module.transit_gateway.transit_gateway_id
existing_transit_gateway_route_table_id = module.transit_gateway.transit_gateway_route_table_id
create_transit_gateway = false
create_transit_gateway_route_table = false
create_transit_gateway_vpc_attachment = true
create_transit_gateway_route_table_association_and_propagation = false
config = {
prod = {
vpc_id = module.vpc_prod.id
vpc_cidr = module.vpc_prod.cidr_block
subnet_ids = module.vpc_prod.private_subnet_ids
subnet_route_table_ids = module.vpc_prod.private_route_table_ids
route_to = null
route_to_cidr_blocks = [
module.vpc_shared.cidr_block,
]
static_routes = null
transit_gateway_vpc_attachment_id = null
}
}
context = module.this.context
providers = {
aws = aws.prod
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment