-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Tags are not propagated on nodegroup ASG #860
Comments
this not a eks terraform module bug but AWS implementation for the managed nodes: see: https://docs.aws.amazon.com/eks/latest/userguide/create-managed-node-group.html
|
For anyone looking for a workaround: locals {
asg_name = module.eks.node_groups["default"]["resources"][0]["autoscaling_groups"][0]["name"]
}
resource "null_resource" "add_custom_tags_to_asg" {
triggers = {
node_group = local.asg_name
}
provisioner "local-exec" {
command = <<EOF
aws autoscaling create-or-update-tags \
--tags ResourceId=${local.asg_name},ResourceType=auto-scaling-group,Key=CUSTOM_TAG_NAME,Value=CUSTOM_TAG_VALUE,PropagateAtLaunch=true
EOF
}
} You can add multiple tags; newly launched nodes will get the custom tags, thanks to |
it worked..thanks |
is the workaround above still needed? |
Thanks @atrepca for the quick WA. FYI: I have also added this And
Unfortunately yes @mteodori, its still needed, |
Hi. I've similar problem but while having more than one node_group it gets more complicated to apply @atrepca 's solution. Maybe someone will find it useful. Use case:
I need to iterate over each node_group and map with tags to apply all of them to every group. resource "null_resource" "add_custom_tags_to_asg" {
for_each = module.eks.node_groups
provisioner "local-exec" {
command = <<EOF
%{ for tagName,tagValue in local.tags }
aws autoscaling create-or-update-tags --tags \
ResourceId=${each.value.resources[0].autoscaling_groups[0].name},\
ResourceType=auto-scaling-group,\
Key=${tagName},\
Value=${tagValue},\
PropagateAtLaunch=true
%{ endfor ~}
EOF
}
} |
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. |
I have added additional tags on node groups and they are not propagated to ASG or EC2.
I'm submitting a...
What is the current behavior?
Tags does not propagate
If this is a bug, how to reproduce? Please include a code sample if relevant.
add tags like above
locals {
common_tags = {
bu = "bu"
envType = var.envType
stackType = "terraform"
}
}
.
.
.
.
node_groups_defaults = {
ami_type = "AL2_x86_64"
disk_size = 50
subnets = split(",",var.private_subnet_ids)
additional_tags = "${merge(
local.common_tags,
map(
"k8s.io/cluster-autoscaler/${local.cluster_name}", "owned",
"k8s.io/cluster-autoscaler/enabled","true",
"stackType", "terraform"
)
)}"
}
What's the expected behavior?
Tags should appear on ASG or EC2
Are you able to fix this problem and submit a PR? Link here if you have already.
No
Environment details
Terraform v0.12.24
terraform-aws-eks 11.0.0
Any other relevant info
The text was updated successfully, but these errors were encountered: