-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
aws_autoscaling_group removes empty tag "value" attributes #9049
Comments
This is version 2.15. |
Hey guys, do you think this is a bug or not? If yes, how are you going to tackle it? |
Having the same issue on provider version 2.28.1 and on 2.29.0. Strangely enough this behavior is not consistent, I have multiple sets of ASGs but some of them will pick up on blank tag just fine |
Another case, ASGs deployed with empty tags prior to 0.12 pass the plan and apply on 2.29.0. |
We've found that this fails when creating an ASG, but only after the ASG is actually created. That is, terraform apply fails, but the ASG does exist afterward, with the empty tag value. Once it exists, you can change the value of the tag—from empty to nonempty, and back again—without any complaint. It's only when first creating the ASG that this seems to fail. |
Issue seems to only exist on object creation -- updates are fine. That is, if you create with an empty tag, it will error and bail, even though the object is created. Amend the TF and run again, it will update the objects target tag from '' -> 'value' and proceed with the rest of the catalog. Adjust the value back to an empty string (or remove entirely) and it will happily update the object to an empty string. |
We had to work around this problem by replacing our intentionally empty tag values with a spurious value. We chose "ignored." However, we happen to be fortunate that the readers of those tags don't mind the strings being nonempty. There could be cases where the empty value is the exact value that the tag must bear. |
A few hours later, I realized that we did have some IAM conditions that were sensitive to these empty tag values. Now we have to revise those conditions if we're going to use nonempty dummy values for our ASG tags to work around this bug. |
we've also encountered this bug on creating ASGs, and reapplying did not fix it, re had to remove the tag and apply wthout it before reapplying with it back in and still empty. |
I'm experiencing this problem even for creation of resources with non-empty tags. Terraform diff shows the following, which is correct:
When I try to apply, I still get the error:
I have Terraform v0.12.21 and AWS Provider v2.59.0. |
It's the tag with key "k8s.io/cluster-autoscaler/clustertest-02" that's causing the problem. |
Oh snap haha. Thank you. Looks like the shelter in place is getting to me 🙃. I'm generating these from a loop, so I missed that. Seems like the value that's getting passed in the loop resolves to "". Same problem that everyone else is having. |
I encounter the same problem. This is especially annoying, since I am using EKS in conjunction with the Kubernetes cluster-autoscaler and want to make sure that my "compute" nodes are recognized as such. (according to docs / best practices, that means that my Kubernetes nodes should be labeled like that: # This is the kubectl command line that can be used to mark a node with name ${node_name}
# to have the role ${node_role}. The value of this label is usually just an empty string.
kubectl label nodes/${node_name} node-role.kubernetes.io/${node_role}= To make sure that the cluster-autoscaler knows that new nodes spawned from this autoscaling group will have the key/value combination, it is necessary to apply the correct AWS tags, though: {
key = "k8s.io/cluster-autoscaler/node-template/label/node-role.kubernetes.io/${node_role}"
value = ""
propagate_at_launch = true
} I can confirm that it is possible to change existing tag values to the empty string, but new ASGs cannot be created. |
WorkaroundUse locals {
tags = [
{
key = "foo"
value = ""
propagate_at_launch = true
},
{
key = "bar"
value = ""
propagate_at_launch = true
}
]
}
resource "aws_autoscaling_group" "this" {
...
...
dynamic "tag" {
for_each = local.tags
content {
key = tag.value["key"]
value = tag.value["value"]
propagate_at_launch = tag.value["propagate_at_launch"]
}
} |
Fix for the issue detailed here: hashicorp/terraform-provider-aws#9049 We cannot merge a map of standard tags with an array of individual tag maps. Co-authored-by: Andy Mitchell <me@themitchell.co.uk> Co-authored-by: Neil Kidd <neil.kidd@madetech.com>
When using tags with an empty value in the latest provider:
the
tag
->value
attributes are removed from the plan and apply errors:values are kept by the output as can be seen in the state file implying this is an issue with the provider not TF core:
The text was updated successfully, but these errors were encountered: