Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Oct 14, 2022
1 parent 7a5890d commit 1a75a27
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions vpc-transit-gateway-association/routing.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module "routing_attachment_ipv4" {
source = "git@github.e.it.census.gov:terraform-modules/aws-vpc-setup.git//routing?ref=tf-upgrade"
count = var.transit_gateway_routing_type == "self" ? 1 : 0
vpc_id = var.vpc_id

vpc_full_name = var.vpc_full_name
Expand Down Expand Up @@ -38,12 +39,13 @@ data "aws_ec2_managed_prefix_list" "tgw_ipv4" {

# pick the first prefix list found, either NAME or NAME.ipv4
resource "aws_route" "gateway_ipv4" {
for_each = module.routing_ipv4.private_route_table_ids
count = var.transit_gateway_routing_type == "self" ? 1 : 0
for_each = var.transit_gateway_routing_type == "self" ? module.routing_attachment_ipv4[0].private_route_table_ids : {}

route_table_id = each.value
# destination_cidr_block = "10.128.0.0/16"
destination_prefix_list_id = one([for k, v in data.aws_ec2_managed_prefix_list.tgw_ipv4 : k if v.address_family == "IPv4"])
transit_gateway_id = data.aws_ec2_transit_gateway.gateway_east.id
transit_gateway_id = data.aws_ec2_transit_gateway.gateway_self.id

depends_on = [aws_ec2_transit_gateway_vpc_attachment.vpc_attachment]
depends_on = var.transit_gateway_routing_type == "self" ? [aws_ec2_transit_gateway_vpc_attachment.vpc_attachment] : []
}

0 comments on commit 1a75a27

Please sign in to comment.