diff --git a/modules/eks-managed-node-group/README.md b/modules/eks-managed-node-group/README.md
index 9605e7fef4..b53bf7f05f 100644
--- a/modules/eks-managed-node-group/README.md
+++ b/modules/eks-managed-node-group/README.md
@@ -129,6 +129,7 @@ module "eks_managed_node_group" {
| [launch\_template\_default\_version](#input\_launch\_template\_default\_version) | Default version of the launch template | `string` | `null` | no |
| [launch\_template\_description](#input\_launch\_template\_description) | Description of the launch template | `string` | `null` | no |
| [launch\_template\_name](#input\_launch\_template\_name) | Launch template name - either to be created (`var.create_launch_template` = `true`) or existing (`var.create_launch_template` = `false`) | `string` | `""` | no |
+| [launch\_template\_tags](#input\_launch\_template\_tags) | A map of additional tags to add to the tag\_specifications of launch template created | `map(string)` | `{}` | no |
| [launch\_template\_use\_name\_prefix](#input\_launch\_template\_use\_name\_prefix) | Determines whether to use `launch_template_name` as is or create a unique name beginning with the `launch_template_name` as the prefix | `bool` | `true` | no |
| [launch\_template\_version](#input\_launch\_template\_version) | Launch template version number. The default is `$Default` | `string` | `null` | no |
| [license\_specifications](#input\_license\_specifications) | A list of license specifications to associate with | `map(string)` | `null` | no |
diff --git a/modules/eks-managed-node-group/main.tf b/modules/eks-managed-node-group/main.tf
index 71972b22e9..ecb0b7e988 100644
--- a/modules/eks-managed-node-group/main.tf
+++ b/modules/eks-managed-node-group/main.tf
@@ -238,7 +238,7 @@ resource "aws_launch_template" "this" {
for_each = toset(["instance", "volume", "network-interface"])
content {
resource_type = tag_specifications.key
- tags = merge(var.tags, { Name = var.name })
+ tags = merge(var.tags, { Name = var.name }, var.launch_template_tags)
}
}
diff --git a/modules/eks-managed-node-group/variables.tf b/modules/eks-managed-node-group/variables.tf
index ddefdcf655..d176ff08d9 100644
--- a/modules/eks-managed-node-group/variables.tf
+++ b/modules/eks-managed-node-group/variables.tf
@@ -238,6 +238,12 @@ variable "placement" {
default = null
}
+variable "launch_template_tags" {
+ description = "A map of additional tags to add to the tag_specifications of launch template created"
+ type = map(string)
+ default = {}
+}
+
################################################################################
# EKS Managed Node Group
################################################################################
diff --git a/modules/self-managed-node-group/README.md b/modules/self-managed-node-group/README.md
index b1ff6b64fd..0d705f730e 100644
--- a/modules/self-managed-node-group/README.md
+++ b/modules/self-managed-node-group/README.md
@@ -128,6 +128,7 @@ module "self_managed_node_group" {
| [launch\_template\_default\_version](#input\_launch\_template\_default\_version) | Default Version of the launch template | `string` | `null` | no |
| [launch\_template\_description](#input\_launch\_template\_description) | Description of the launch template | `string` | `null` | no |
| [launch\_template\_name](#input\_launch\_template\_name) | Launch template name - either to be created (`var.create_launch_template` = `true`) or existing (`var.create_launch_template` = `false`) | `string` | `null` | no |
+| [launch\_template\_tags](#input\_launch\_template\_tags) | A map of additional tags to add to the tag\_specifications of launch template created | `map(string)` | `{}` | no |
| [launch\_template\_use\_name\_prefix](#input\_launch\_template\_use\_name\_prefix) | Determines whether to use `launch_template_name` as is or create a unique name beginning with the `launch_template_name` as the prefix | `bool` | `true` | no |
| [launch\_template\_version](#input\_launch\_template\_version) | Launch template version. Can be version number, `$Latest`, or `$Default` | `string` | `null` | no |
| [license\_specifications](#input\_license\_specifications) | A list of license specifications to associate with | `map(string)` | `null` | no |
diff --git a/modules/self-managed-node-group/main.tf b/modules/self-managed-node-group/main.tf
index e1e35981fc..3f0efc3854 100644
--- a/modules/self-managed-node-group/main.tf
+++ b/modules/self-managed-node-group/main.tf
@@ -229,7 +229,7 @@ resource "aws_launch_template" "this" {
for_each = toset(["instance", "volume", "network-interface"])
content {
resource_type = tag_specifications.key
- tags = merge(var.tags, { Name = var.name })
+ tags = merge(var.tags, { Name = var.name }, var.launch_template_tags)
}
}
diff --git a/modules/self-managed-node-group/variables.tf b/modules/self-managed-node-group/variables.tf
index 7bcebeaddc..e9f8646a40 100644
--- a/modules/self-managed-node-group/variables.tf
+++ b/modules/self-managed-node-group/variables.tf
@@ -250,6 +250,12 @@ variable "metadata_options" {
}
}
+variable "launch_template_tags" {
+ description = "A map of additional tags to add to the tag_specifications of launch template created"
+ type = map(string)
+ default = {}
+}
+
################################################################################
# Autoscaling group
################################################################################
diff --git a/node_groups.tf b/node_groups.tf
index a0884356f0..0381005a24 100644
--- a/node_groups.tf
+++ b/node_groups.tf
@@ -273,6 +273,7 @@ module "eks_managed_node_group" {
launch_template_use_name_prefix = try(each.value.launch_template_use_name_prefix, var.eks_managed_node_group_defaults.launch_template_use_name_prefix, true)
launch_template_version = try(each.value.launch_template_version, var.eks_managed_node_group_defaults.launch_template_version, null)
launch_template_description = try(each.value.launch_template_description, var.eks_managed_node_group_defaults.launch_template_description, "Custom launch template for ${try(each.value.name, each.key)} EKS managed node group")
+ launch_template_tags = try(each.value.launch_template_tags, var.eks_managed_node_group_defaults.launch_template_tags, {})
ebs_optimized = try(each.value.ebs_optimized, var.eks_managed_node_group_defaults.ebs_optimized, null)
key_name = try(each.value.key_name, var.eks_managed_node_group_defaults.key_name, null)
@@ -390,6 +391,7 @@ module "self_managed_node_group" {
launch_template_use_name_prefix = try(each.value.launch_template_use_name_prefix, var.self_managed_node_group_defaults.launch_template_use_name_prefix, true)
launch_template_version = try(each.value.launch_template_version, var.self_managed_node_group_defaults.launch_template_version, null)
launch_template_description = try(each.value.launch_template_description, var.self_managed_node_group_defaults.launch_template_description, "Custom launch template for ${try(each.value.name, each.key)} self managed node group")
+ launch_template_tags = try(each.value.launch_template_tags, var.self_managed_node_group_defaults.launch_template_tags, {})
ebs_optimized = try(each.value.ebs_optimized, var.self_managed_node_group_defaults.ebs_optimized, null)
ami_id = try(each.value.ami_id, var.self_managed_node_group_defaults.ami_id, "")