From dcac70dfd18d0fa6057f6b213a6d364a847cd957 Mon Sep 17 00:00:00 2001 From: Pierre CARRE Date: Thu, 4 Mar 2021 11:05:39 +0100 Subject: [PATCH] Add a condition to build SNAT rules only when a NAT GW is requested --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 97b38bd..ffb2929 100644 --- a/main.tf +++ b/main.tf @@ -47,7 +47,7 @@ locals { vpc_subnets_map = zipmap(local.vpc_subnets_keys, local.vpc_subnets_values) vpc_subnets_snat_cidr = flatten([for name in var.vpc_snat_subnets : [for subnet in var.vpc_subnets : subnet.subnet_cidr if subnet.subnet_name == name]]) - vpc_subnets_snat_cidr_map = zipmap(local.vpc_subnets_snat_cidr, local.vpc_subnets_snat_cidr) + vpc_subnets_snat_cidr_map = var.enable_nat_gateway ? zipmap(local.vpc_subnets_snat_cidr, local.vpc_subnets_snat_cidr) : {} }