diff --git a/modules/node_groups/launchtemplate.tf b/modules/node_groups/launchtemplate.tf index 1da04e2037..7b50350dd2 100644 --- a/modules/node_groups/launchtemplate.tf +++ b/modules/node_groups/launchtemplate.tf @@ -98,6 +98,20 @@ resource "aws_launch_template" "workers" { ) } + # Supplying custom tags to EKS instances ENI's + tag_specifications { + resource_type = "network-interface" + + tags = merge( + var.tags, + lookup(var.node_groups_defaults, "additional_tags", {}), + lookup(var.node_groups[each.key], "additional_tags", {}), + { + Name = lookup(each.value, "name", join("-", [var.cluster_name, each.key, random_pet.node_groups[each.key].id])) + } + ) + } + # Tag the LT itself tags = merge( var.tags, diff --git a/workers_launch_template.tf b/workers_launch_template.tf index 3710b0a2b3..aaea9616cc 100644 --- a/workers_launch_template.tf +++ b/workers_launch_template.tf @@ -563,6 +563,24 @@ resource "aws_launch_template" "workers_launch_template" { ) } + tag_specifications { + resource_type = "network-interface" + + tags = merge( + { + "Name" = "${coalescelist(aws_eks_cluster.this[*].name, [""])[0]}-${lookup( + var.worker_groups_launch_template[count.index], + "name", + count.index, + )}-eks_asg" + }, + { for tag_key, tag_value in var.tags : + tag_key => tag_value + if tag_key != "Name" && !contains([for tag in lookup(var.worker_groups_launch_template[count.index], "tags", local.workers_group_defaults["tags"]) : tag["key"]], tag_key) + } + ) + } + tags = var.tags lifecycle {