From 010881d19e1cada9852f1f9bb3d5775c4bf6a6f1 Mon Sep 17 00:00:00 2001 From: Benjamin Smith Date: Mon, 7 Oct 2024 13:13:29 -0700 Subject: [PATCH] bugfix when tgw is enabled --- main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index db43566..3be2c47 100644 --- a/main.tf +++ b/main.tf @@ -5,7 +5,7 @@ locals { transit_gateway_enabled = local.enabled && var.transit_gateway_enabled transit_gateway_attachment_id = join("", aws_vpn_connection.default[*].transit_gateway_attachment_id) - vpn_gateway_id = join("", aws_vpn_gateway.default[*].id) + vpn_gateway_id = one(aws_vpn_gateway.default[*].id) customer_gateway_id = join("", aws_customer_gateway.default[*].id) vpn_connection_id = join("", aws_vpn_connection.default[*].id) } @@ -96,7 +96,7 @@ resource "aws_vpn_connection" "default" { # https://www.terraform.io/docs/providers/aws/r/vpn_gateway_route_propagation.html resource "aws_vpn_gateway_route_propagation" "default" { - count = local.enabled ? length(var.route_table_ids) : 0 + count = local.enabled && !var.transit_gateway_enabled ? length(var.route_table_ids) : 0 vpn_gateway_id = local.vpn_gateway_id route_table_id = element(var.route_table_ids, count.index) }