Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow user to set name tag value when creating workers using launch templates #1688

Closed
aydasraf opened this issue Nov 10, 2021 · 5 comments · Fixed by #1680
Closed

Allow user to set name tag value when creating workers using launch templates #1688

aydasraf opened this issue Nov 10, 2021 · 5 comments · Fixed by #1680
Labels

Comments

@aydasraf
Copy link

Is your request related to a new offering from AWS?

No

Is your request related to a problem? Please describe.

Yes, I am creating an EKS cluster using version 17.23.0 using worker_groups_launch_template, I am trying to set name tags for the instances to our naming standard to allow domain join for those nodes, by setting the name tag in the code like below:

tags  = [
          {
            key                 = "Name"
            value               = "xxx-yyy-eks"
            propagate_at_launch = true
          },
          {
            key                 = "ADJoin"
            value               = true
            propagate_at_launch = true
          }
        ]

but sadly the module overrides the works by using force cluster_name - work_group_name-eks_sg, code here:

tag_specifications {
resource_type = "volume"
tags = merge(
{
"Name" = "${local.cluster_name}-${lookup(
var.worker_groups_launch_template[count.index],
"name",
count.index,
)}-eks_asg"
},
var.tags,
{
for tag in lookup(var.worker_groups_launch_template[count.index], "tags", local.workers_group_defaults["tags"]) :
tag["key"] => tag["value"]
if tag["key"] != "Name" && tag["propagate_at_launch"]
}
)
}
tag_specifications {
resource_type = "instance"
tags = merge(
{
"Name" = "${local.cluster_name}-${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)
}
)
}
tag_specifications {
resource_type = "network-interface"
tags = merge(
{
"Name" = "${local.cluster_name}-${lookup(
var.worker_groups_launch_template[count.index],
"name",
count.index,
)}-eks_asg"
},
var.tags,
{
for tag in lookup(var.worker_groups_launch_template[count.index], "tags", local.workers_group_defaults["tags"]) :
tag["key"] => tag["value"]
if tag["key"] != "Name" && tag["propagate_at_launch"]
}
)
}
which causes the domain join to fail and the nodes to be outside of our org naming convention causing a huge mess.

Describe the solution you'd like.

if the name tag is set in the tags, respect that and use these values, if not build the value as previously done.

tag_specifications {
resource_type = "volume"
tags = merge(
{
"Name" = "${local.cluster_name}-${lookup(
var.worker_groups_launch_template[count.index],
"name",
count.index,
)}-eks_asg"
},
var.tags,
{
for tag in lookup(var.worker_groups_launch_template[count.index], "tags", local.workers_group_defaults["tags"]) :
tag["key"] => tag["value"]
if tag["key"] != "Name" && tag["propagate_at_launch"]
}
)
}
tag_specifications {
resource_type = "instance"
tags = merge(
{
"Name" = "${local.cluster_name}-${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)
}
)
}
tag_specifications {
resource_type = "network-interface"
tags = merge(
{
"Name" = "${local.cluster_name}-${lookup(
var.worker_groups_launch_template[count.index],
"name",
count.index,
)}-eks_asg"
},
var.tags,
{
for tag in lookup(var.worker_groups_launch_template[count.index], "tags", local.workers_group_defaults["tags"]) :
tag["key"] => tag["value"]
if tag["key"] != "Name" && tag["propagate_at_launch"]
}
)
}

Describe alternatives you've considered.

Manually overriding the workers_launch_template.tf to fulfill this, is not convenient and caused a couple of incidents!

Additional context

N/A

@aydasraf
Copy link
Author

aydasraf commented Nov 15, 2021

Hello @daroga0002 , Sorry to push but did you have the time to look into this issue?

@github-actions
Copy link

This issue has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this issue will be closed in 10 days

@github-actions github-actions bot added the stale label Dec 16, 2021
@github-actions
Copy link

This issue was automatically closed because of stale in 10 days

@antonbabenko
Copy link
Member

This issue has been resolved in version 18.0.0 🎉

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
2 participants