From d8fc592fee9fe603bed97ea6caeda2285b2e5eda Mon Sep 17 00:00:00 2001 From: "Matthew C. Morgan" Date: Mon, 29 Jul 2024 22:01:35 -0400 Subject: [PATCH] add subnet tags --- dns_zones.tf | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/dns_zones.tf b/dns_zones.tf index 380900b..c54d080 100644 --- a/dns_zones.tf +++ b/dns_zones.tf @@ -136,6 +136,22 @@ resource "aws_vpc" "vpc" { { "Name" = "vpc0-dummy" }, ) } +# Tag existing subnets for EKS +# Container subnets under data.aws_subnets.container-subnets +# Load Balance subnets under data.aws_subnets.lb-subnets +resource "aws_ec2_tag" "container-subnets" { + for_each = toset(data.aws_subnets.container-subnets.ids) + resource_id = each.value + key = "kubernetes.io/cluster/${var.cluster_name}" + value = "shared" +} + +resource "aws_ec2_tag" "lb-subnets" { + for_each = toset(data.aws_subnets.lb-subnets.ids) + resource_id = each.value + key = "kubernetes.io/role/internal-nlb" + value = "1" +} #### This is the correct way, it's commented because #### the module is throwing an error on the for_each