Skip to content

Commit 0ed32d7

Browse files
authored
fix: Use the launch_template_tags on the launch template (#2957)
1 parent 71b5031 commit 0ed32d7

File tree

2 files changed

+10
-1
lines changed
  • examples/eks_managed_node_group
  • modules/eks-managed-node-group

2 files changed

+10
-1
lines changed

examples/eks_managed_node_group/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,12 @@ module "eks" {
264264
additional = aws_iam_policy.node_additional.arn
265265
}
266266

267+
launch_template_tags = {
268+
# enable discovery of autoscaling groups by cluster-autoscaler
269+
"k8s.io/cluster-autoscaler/enabled" : true,
270+
"k8s.io/cluster-autoscaler/${local.name}" : "owned",
271+
}
272+
267273
tags = {
268274
ExtraTag = "EKS managed node group complete example"
269275
}

modules/eks-managed-node-group/main.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,10 @@ resource "aws_launch_template" "this" {
312312
user_data = module.user_data.user_data
313313
vpc_security_group_ids = length(local.network_interfaces) > 0 ? [] : local.security_group_ids
314314

315-
tags = var.tags
315+
tags = merge(
316+
var.tags,
317+
var.launch_template_tags,
318+
)
316319

317320
# Prevent premature access of policies by pods that
318321
# require permissions on create/destroy that depend on nodes

0 commit comments

Comments
 (0)