From 0ed32d7b291513f34775ca85b0aa33da085d09fa Mon Sep 17 00:00:00 2001 From: Bryant Biggs Date: Thu, 7 Mar 2024 14:40:43 -0500 Subject: [PATCH] fix: Use the `launch_template_tags` on the launch template (#2957) --- examples/eks_managed_node_group/main.tf | 6 ++++++ modules/eks-managed-node-group/main.tf | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/examples/eks_managed_node_group/main.tf b/examples/eks_managed_node_group/main.tf index 17ff2bb..e464ca7 100644 --- a/examples/eks_managed_node_group/main.tf +++ b/examples/eks_managed_node_group/main.tf @@ -264,6 +264,12 @@ module "eks" { additional = aws_iam_policy.node_additional.arn } + launch_template_tags = { + # enable discovery of autoscaling groups by cluster-autoscaler + "k8s.io/cluster-autoscaler/enabled" : true, + "k8s.io/cluster-autoscaler/${local.name}" : "owned", + } + tags = { ExtraTag = "EKS managed node group complete example" } diff --git a/modules/eks-managed-node-group/main.tf b/modules/eks-managed-node-group/main.tf index fa74cd3..75ee289 100644 --- a/modules/eks-managed-node-group/main.tf +++ b/modules/eks-managed-node-group/main.tf @@ -312,7 +312,10 @@ resource "aws_launch_template" "this" { user_data = module.user_data.user_data vpc_security_group_ids = length(local.network_interfaces) > 0 ? [] : local.security_group_ids - tags = var.tags + tags = merge( + var.tags, + var.launch_template_tags, + ) # Prevent premature access of policies by pods that # require permissions on create/destroy that depend on nodes