-
-
Notifications
You must be signed in to change notification settings - Fork 317
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
Add a 'static_tags' option to disable automatic merging of tags #131
Conversation
/test all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Makeshift Thank you for this contribution.
I think I understand the problem, though maybe you want to explain it in further detail, because it does not look to me like this PR solves the problem.
As I understand it, the issue is that the current AWS provider does not like it when a resource's tags have the same keys as the provider's default_tags
. However, in some cases, modules add tags that are critical to proper functioning of the module, such as tagging resources as managed by an autoscaler or belonging to a Kubernetes cluster. So we cannot allow an option that blocks modules from adding tags.
To me this suggest 2 reasonable solutions:
- Tell people not to use the
default_tags
option to the provider and instead implementdefault_tags
in null-label and have people use null-label'stags
output. This has the added advantage of properly allowing tags to be overridden, which the AWS provider seem not to support. Of course the disadvantage is that this does not cover any resources created by modules that do not use null-label. And in fact, we do not even need a new input for this. Simply setting the currenttags
input with the set of default tags in a base null-label module in the root module would do it. - Add some input like
suppress_tags
which provides a list of tag keys to filter out of thetags
output, so those tags are not set in resources. The trade-off here is that while this ensures all resources get the default tags via the provider, the default tags cannot be overridden.
@Makeshift What do you think of those solutions?
You're correct in your assessment - Thank you for pointing out the flaw in disabling tags, it didn't occur to me that they could be integral to the working of certain resources/services. Do you have an example of a module that does this so I can make sure that any changes I make doesn't break it?
That disadvantage is rather a large one, unfortunately, I believe that
This seems like a reasonable compromise. You're suggesting something along the lines of allowing the user to set
? Edit: I've implemented and committed what I think you were proposing, let me know :) |
…g generation of tags entirely
/test all |
@Makeshift I hope you do not mind, I am going to steal this idea and some of this code and re-implement it in my current PR, rather than ask you to make additional changes. |
what
static_tags
, set to false by default, which stops the module from merging in new tags and instead uses thetags
variable in the input as-is, including handing it off to other modules as necessarywhy
cloudposse
modules can be useful in certain circumstancesI have a fork of
terraform-null-label
that removes tags that interfere with providerdefault_tags
, but this isn't obeyed by downstream cloudposse modules. This PR should make it possible to pass context in and force null_label to not make any tags, or only make a subset of the tags :)references