From 0135a99073de05d4d670aa95d9304e26b10ded49 Mon Sep 17 00:00:00 2001 From: Pathma Sri Ambegode Gedara Date: Mon, 19 Jun 2023 23:45:40 -0400 Subject: [PATCH] PRODENG-2235 Tag security groups in launchpad-aws terraform module --- modules/master/main.tf | 7 +++++-- modules/worker/main.tf | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/modules/master/main.tf b/modules/master/main.tf index d95ecd7..27a20fd 100644 --- a/modules/master/main.tf +++ b/modules/master/main.tf @@ -23,6 +23,9 @@ resource "aws_security_group" "master" { protocol = "tcp" cidr_blocks = ["0.0.0.0/0"] } + tags = { + "kubernetes.io/cluster/${var.cluster_name}" = "owned" + } } locals { @@ -34,8 +37,8 @@ resource "aws_instance" "mke_master" { count = var.master_count tags = tomap({ - "Name" = "${var.cluster_name}-master-${count.index + 1}", - "Role" = "manager", + "Name" = "${var.cluster_name}-master-${count.index + 1}", + "Role" = "manager", (var.kube_cluster_tag) = "shared" }) diff --git a/modules/worker/main.tf b/modules/worker/main.tf index 4603d23..dc065de 100644 --- a/modules/worker/main.tf +++ b/modules/worker/main.tf @@ -2,6 +2,9 @@ resource "aws_security_group" "worker" { name = "${var.cluster_name}-workers" description = "mke cluster workers" vpc_id = var.vpc_id + tags = { + "kubernetes.io/cluster/${var.cluster_name}" = "owned" + } } locals { @@ -13,8 +16,8 @@ resource "aws_instance" "mke_worker" { count = var.worker_count tags = tomap({ - "Name" = "${var.cluster_name}-worker-${count.index + 1}", - "Role" = "worker", + "Name" = "${var.cluster_name}-worker-${count.index + 1}", + "Role" = "worker", (var.kube_cluster_tag) = "shared" })