Backport of Prefer KV tags, even when tags are defined as set into v1.10 #35978
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport
This PR is auto-generated from #35937 to be assessed for backporting due to the inclusion of the label 1.10-backport.
The below text is copied from the body of the original PR.
Target Release
1.10.0
Fixes a bug in a the new cloud tags matching that duplicated tags in the backend when set tags are matched using kv bindings, or vice-versa.
In other words, if the workspace was found by set type tags in config, but the actual tags are KV tags, previously, terraform would detect that it should update the workspace with the tags unnecessarily, setting both workspace tags and kv tags. This also happens in the opposite sense: if kv tags are defined in config but matched to pre-existing workspace tags.
I changed the behavior to prefer setting kv tags if they are supported on the backend and evaluating both kinds of tags to determine if an update is needed, regardless of the desired tag provenance.
Overview of commits
ad96f41
f41d5a5