-
-
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
Module resources not inheriting default_tags
from AWS provider.
#1455
Comments
I recognize that this is a known issue with the default tagging as documented (https://www.hashicorp.com/blog/default-tags-in-the-terraform-aws-provider) but the issue I have is that I cannot do both. I can't set it in |
Seeing the same issue - I'm guessing it is related to the fix for #860 My understanding is that out of the box EKS's ASGs don't propagate tags correctly, so the fix for the above applies a specific workaround directly to the ASG. The workaround isn't looking at the default tags, just the tags passed to the module. Presumably needs to do some combination of the two - perhaps by using |
This seems solvable via the use of launch templates. I would like avoid manually managing my launch template, but the module should be able to pull in tags and add them to the launch template. It may require some more advanced configuration because launch templates can specify which tags are applied to different resources used by the instance. |
This adds some of the tags from the [tagging guide] from the previous ECS project. I've omitted `chargeable_entity` and `environment` because those might need a bit of a rethink in light of the switch to Kubernetes. (For example is the "environment" the same thing from an infrastructure perspective as it is from the cluster-user/developer/application perspective?) The idea here is really just to define a place to put the common tags so that we continue to set them in the right way. Using [provider default tags] (relatively new feature) is now the cleanest way to do this. Thanks to @kerin for the suggestion of using provider default tags. One caveat is that the default tags aren't propagated to ASGs, so this doesn't currently tag the node pool ASG. Passing the same set of tags to the `eks` module in order to tag the ASG doesn't work, because the TF provider unhelpfully forbids individual resources from overriding provider-specific tags because of a design limitation of TF. (See hashicorp/terraform-provider-aws#19204.) [tagging guide]: https://github.com/alphagov/govuk-infrastructure/blob/main/terraform/docs/tagging-guide.md [provider default tags]: https://www.hashicorp.com/blog/default-tags-in-the-terraform-aws-provider
FYI - this does not have anything to do with the module, it is purely controlled within the upstream AWS provider. we can leave this open but there won't be anything we can do here when it comes to ref https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags
|
looks like this new release could offer a resolution hashicorp/terraform-provider-aws#20009 |
Another issue is tagging |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically closed because it has not had recent activity since being marked as stale. |
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. |
Description
Setting
default_tags
in a provider block does not percolate down to resources created by the module.Before you submit an issue, please perform the following first:
.terraform
directory (! ONLY if state is stored remotely, which hopefully you are following that best practice!):rm -rf .terraform/
terraform init
Versions
Reproduction
Steps to reproduce the behavior:
Set a locals with a base_tags variable:
Apply default_tags to the aws provider:
terraform apply
Observe no tags applied to the resources (such as AWS EC2 Autoscaling groups
Code Snippet to Reproduce
Expected behavior
Tags applied to resources created by the module
Actual behavior
No tags applied to resources created by the module
Additional context
Its also worth noting that
default_tags
in the provider also conflict with settingtags
in the module itself. I get a complaint about de-duplicating tags. This would not be a big deal if I did not need to create other AWS resources outside of this module.The text was updated successfully, but these errors were encountered: