From 73588a29e616727b89d14065be3af3c3f14bd84f Mon Sep 17 00:00:00 2001 From: Sean Rankine Date: Mon, 29 Jan 2024 17:32:39 +0000 Subject: [PATCH] Remove old NATs in staging and production This removes the orginal NAT Gateways and EIPs that are no longer being used. --- terraform/deployments/cluster-infrastructure/vpc.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform/deployments/cluster-infrastructure/vpc.tf b/terraform/deployments/cluster-infrastructure/vpc.tf index e8d4019b1..5114ccf1e 100644 --- a/terraform/deployments/cluster-infrastructure/vpc.tf +++ b/terraform/deployments/cluster-infrastructure/vpc.tf @@ -93,14 +93,14 @@ resource "aws_route" "public_internet_gateway" { } resource "aws_eip" "eks_nat" { - for_each = var.eks_public_subnets + for_each = length(var.eks_licensify_gateways) == 0 ? var.eks_public_subnets : {} vpc = true tags = { Name = "${var.cluster_name}-eks-nat-${each.key}" } # TODO: depends_on = [aws_internet_gateway.gw] once we've imported the IGW from govuk-aws. } resource "aws_nat_gateway" "eks" { - for_each = var.eks_public_subnets + for_each = length(var.eks_licensify_gateways) == 0 ? var.eks_public_subnets : {} allocation_id = aws_eip.eks_nat[each.key].id subnet_id = aws_subnet.eks_public[each.key].id tags = { Name = "${var.cluster_name}-eks-${each.key}" }