-
Notifications
You must be signed in to change notification settings - Fork 85
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 ignore_tags feature for segments #1212
Conversation
/test-all |
If VCD or such uses the same tag names across various resources, would it make sense to set these at the provider level, rather than on each resource individually? |
I have chosen to expose attribute on resource level for two reasons:
|
Description: "Tags matching scopes to ignore", | ||
Computed: true, | ||
Elem: &schema.Resource{ | ||
Schema: map[string]*schema.Schema{ |
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.
Can getTagsSchemaInternal()
be recycled here in some way?
Other than this LGTM
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.
This one is fully computed, I didn't want to add to many params to getTagsSchemaInternal
/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.
All good, but I think we should have this capability validated in acceptance tests.
It won't be a trivial test, but also not a very complex one
Other tools (like VCD) may add tags to certain NSX objects managed by terraform, and expects those tags to be persisted. However, terraform provider assumes itself to be the only source of truth, and in case described above it detect drift in tags, and delete them with apply. This PR allows user to specify a list of tag scopes that should be ignored by the provider, more specifically: 1. diff should not be detected when such tags are present on NSX but not in terraform config 2. when provider applies tags from its own config, tags from the `ignore` list should not be deleted. Implementation suggested here changes the Read function to sort tags into two buckets: regular tags and ignored tags. Regular tags are managed as before, whilw ignored tags (computed attribute) are appended to regular tag list on each apply. Future enhancements: 1. Add regexp to compare scopes 2. Add this feature to more resources if needed Signed-off-by: Anna Khmelnitsky <akhmelnitsky@vmware.com>
@annakhm, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding
|
/test-all |
Other tools (like VCD) may add tags to certain NSX objects managed by terraform, and expect those tags to be persisted. However, terraform provider assumes itself to be the only source of truth, and in case described above it detects drift in tags, and deletes them with apply.
This PR allows user to specify a list of tag scopes that should be ignored by the provider, more specifically:
ignore
list should not be deleted.Implementation suggested here changes the Read function to sort tags into two buckets: regular tags and ignored tags. Regular tags are managed as before, whilw ignored tags (computed attribute) are appended to regular tag list on each apply.
Future enhancements: