Skip to content

Commit b5ae5da

Browse files
authored
fix: Avoid re-naming the primary security group through a Name tag and leave to the EKS service to manage (terraform-aws-modules#2010)
1 parent 69a815c commit b5ae5da

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

examples/eks_managed_node_group/main.tf

+7
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,13 @@ module "eks" {
6767
resources = ["secrets"]
6868
}]
6969

70+
cluster_tags = {
71+
# This should not affect the name of the cluster primary security group
72+
# Ref: https://github.com/terraform-aws-modules/terraform-aws-eks/pull/2006
73+
# Ref: https://github.com/terraform-aws-modules/terraform-aws-eks/pull/2008
74+
Name = local.name
75+
}
76+
7077
vpc_id = module.vpc.vpc_id
7178
subnet_ids = module.vpc.private_subnets
7279

main.tf

+4-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ resource "aws_eks_cluster" "this" {
6060
}
6161

6262
resource "aws_ec2_tag" "cluster_primary_security_group" {
63-
for_each = { for k, v in merge(var.tags, var.cluster_tags) : k => v if local.create }
63+
# This should not affect the name of the cluster primary security group
64+
# Ref: https://github.com/terraform-aws-modules/terraform-aws-eks/pull/2006
65+
# Ref: https://github.com/terraform-aws-modules/terraform-aws-eks/pull/2008
66+
for_each = { for k, v in merge(var.tags, var.cluster_tags) : k => v if local.create && k != "Name" }
6467

6568
resource_id = aws_eks_cluster.this[0].vpc_config[0].cluster_security_group_id
6669
key = each.key

0 commit comments

Comments
 (0)