Skip to content

Commit

Permalink
chore: once the default propagation table is set, trusted attachments…
Browse files Browse the repository at this point in the history
… don't need to be propagated
  • Loading branch information
gambol99 committed Oct 8, 2024
1 parent 71d61fd commit 654d906
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions trusted.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,6 @@ resource "aws_ec2_transit_gateway_route_table_association" "trusted" {
transit_gateway_route_table_id = aws_ec2_transit_gateway_route_table.trusted[0].id
}

## We need to propagate the routes for the trusted attachments into the trusted routing
## table. This will allow traffic to flow from the trusted routing table to the trusted
## routing table.
resource "aws_ec2_transit_gateway_route_table_propagation" "trusted" {
for_each = local.enable_trusted == true ? var.connectivity_config.trusted.trusted_attachments : {}

transit_gateway_attachment_id = each.value
transit_gateway_route_table_id = aws_ec2_transit_gateway_route_table.trusted[0].id
}

## We need to add propagate the routes of the trusted attached into the unstrusted
## routing table. This will allow traffic to flow from the untrusted routing table
## to the trusted routing table.
Expand Down Expand Up @@ -109,23 +99,23 @@ resource "aws_ec2_transit_gateway_route_table_propagation" "trusted_ingress" {

## We need to propagate the egress vpc into the trusted route table
resource "aws_ec2_transit_gateway_route_table_propagation" "trusted_egress" {
count = local.enable_trusted == true && local.enable_egress == true && local.enable_default_route_table_propagation == false ? 1 : 0
count = local.enable_trusted == true && local.enable_egress == true ? 1 : 0

transit_gateway_attachment_id = module.egress_vpc[0].transit_gateway_attachment_id
transit_gateway_route_table_id = aws_ec2_transit_gateway_route_table.trusted[0].id
}

## We need to propagate the endpoints vpc into the trusted route table
resource "aws_ec2_transit_gateway_route_table_propagation" "trusted_endpoints" {
count = local.enable_trusted == true && local.enable_endpoints == true && local.enable_default_route_table_propagation == false ? 1 : 0
count = local.enable_trusted == true && local.enable_endpoints == true ? 1 : 0

transit_gateway_attachment_id = local.endpoints_vpc_attachment_id
transit_gateway_route_table_id = aws_ec2_transit_gateway_route_table.trusted[0].id
}

## We need to propagate the dns vpc into the trusted route table
resource "aws_ec2_transit_gateway_route_table_propagation" "trusted_dns" {
count = local.enable_trusted == true && local.enable_dns == true && local.enable_default_route_table_propagation == false ? 1 : 0
count = local.enable_trusted == true && local.enable_dns == true ? 1 : 0

transit_gateway_attachment_id = module.dns_vpc[0].transit_gateway_attachment_id
transit_gateway_route_table_id = aws_ec2_transit_gateway_route_table.trusted[0].id
Expand Down

0 comments on commit 654d906

Please sign in to comment.