-
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
Implement configuring ignore_tags via environment variables #35264
Conversation
Community NoteVoting for Prioritization
For Submitters
|
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.
Welcome @bberg-indeed 👋
It looks like this is your first Pull Request submission to the Terraform AWS Provider! If you haven’t already done so please make sure you have checked out our CONTRIBUTOR guide and FAQ to make sure your contribution is adhering to best practice and has all the necessary elements in place for a successful approval.
Also take a look at our FAQ which details how we prioritize Pull Requests for inclusion.
Thanks again, and welcome to the community! 😃
One of my coworkers suggested adding an "EXTRA" to the environment names, like TF_AWS_EXTRA_IGNORE_TAGS_KEYS, to make it clear that the tag keys in the environment variable are merged with the tag keys specified in the HCL, so that's another option. |
Hello @bberg-indeed 👋, thanks for implementing this! Given the significant community interest, we've been discussing internally how to approach extending all available provider tagging options via environment variables in a consistent way. #33339 has implemented a workflow for I'm planning to have both PRs in before the next release ( |
To confirm one point from the original PR body - in our internal design document we also came to the conclusion that merging was the most reasonable behavior when values are provided both via environment variables and the provider configuration. I'll be adding comments and examples to the provider documentation which describe this behavior. |
Also updates go docs for the default tags and ignore tags environment variables constants
```console % go test -v ./internal/provider/... -run=TestExpandIgnoreTags ? github.com/hashicorp/terraform-provider-aws/internal/provider/fwprovider [no test files] === RUN TestExpandIgnoreTags --- PASS: TestExpandIgnoreTags (0.00s) PASS ok github.com/hashicorp/terraform-provider-aws/internal/provider 4.747s ```
These changes retain legacy behavior which returns nil when no keys or prefixes are set and, for non-nil return objects, returns nil for empty key or prefix lists rather than the zero value `KeyValueTags` struct. Also adds additional test cases to cover variations on empty keys/prefixes and duplicated values.
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.
LGTM 🎉
% TF_ACC=1 go test ./internal/provider/...
? github.com/hashicorp/terraform-provider-aws/internal/provider/fwprovider [no test files]
ok github.com/hashicorp/terraform-provider-aws/internal/provider 75.832s
Thanks for your contribution, @bberg-indeed! 👍 |
This functionality has been released in v5.62.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Description
Implements support for setting ignore_tags via the environment variables TF_AWS_IGNORE_TAGS_KEYS and TF_AWS_IGNORE_TAGS_KEY_PREFIXES, which can be set to comma-separated lists of tag keys or key prefixes.
The keys and prefixes specified via these variables are merged with those explicitly specified in the HCL provider definition. I do understand that this approach has some drawbacks, so I'd like to get some feedback on this approach before writing the documentation for this change.
Relations
Closes #35243
Relates #33339
References
Output from Acceptance Testing