Skip to content

Commit 9541059

Browse files
Add mutex to google_tags_tag_binding (#5878) (#11442)
Co-authored-by: Stephen Lewis (Burrows) <[email protected]> Signed-off-by: Modular Magician <[email protected]> Co-authored-by: Stephen Lewis (Burrows) <[email protected]>
1 parent a80547d commit 9541059

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

.changelog/5878.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
tags: fixed issue where tags could not be applied sequentially to the same parent in `google_tags_tag_binding`
3+
```

google/resource_tags_tag_binding.go

+14
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ func resourceTagsTagBindingCreate(d *schema.ResourceData, meta interface{}) erro
8383
obj["tagValue"] = tagValueProp
8484
}
8585

86+
lockName, err := replaceVars(d, config, "tagBindings/{{parent}}")
87+
if err != nil {
88+
return err
89+
}
90+
mutexKV.Lock(lockName)
91+
defer mutexKV.Unlock(lockName)
92+
8693
url, err := replaceVars(d, config, "{{TagsBasePath}}tagBindings")
8794
if err != nil {
8895
return err
@@ -204,6 +211,13 @@ func resourceTagsTagBindingDelete(d *schema.ResourceData, meta interface{}) erro
204211

205212
billingProject := ""
206213

214+
lockName, err := replaceVars(d, config, "tagBindings/{{parent}}")
215+
if err != nil {
216+
return err
217+
}
218+
mutexKV.Lock(lockName)
219+
defer mutexKV.Unlock(lockName)
220+
207221
url, err := replaceVars(d, config, "{{TagsBasePath}}tagBindings/{{name}}")
208222
if err != nil {
209223
return err

0 commit comments

Comments
 (0)