Skip to content

Commit 3a6a44d

Browse files
modular-magicianEdward Sun
and
Edward Sun
authored
Add mutex to google_tags_location_tag_binding (#8329) (#15189)
Signed-off-by: Modular Magician <[email protected]> Co-authored-by: Edward Sun <[email protected]>
1 parent 15a5960 commit 3a6a44d

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

.changelog/8329.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
tags: Add mutex to `google_tags_location_tag_binding`
3+
```

google/services/tags/resource_tags_location_tag_bindings.go

+14
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@ func resourceTagsLocationTagBindingCreate(d *schema.ResourceData, meta interface
8181
obj["tagValue"] = tagValueProp
8282
}
8383

84+
lockName, err := tpgresource.ReplaceVars(d, config, "tagBindings/{{parent}}")
85+
if err != nil {
86+
return err
87+
}
88+
transport_tpg.MutexStore.Lock(lockName)
89+
defer transport_tpg.MutexStore.Unlock(lockName)
90+
8491
url, err := tpgresource.ReplaceVars(d, config, "{{TagsLocationBasePath}}tagBindings")
8592
log.Printf("url for TagsLocation: %s", url)
8693
if err != nil {
@@ -249,6 +256,13 @@ func resourceTagsLocationTagBindingDelete(d *schema.ResourceData, meta interface
249256

250257
billingProject := ""
251258

259+
lockName, err := tpgresource.ReplaceVars(d, config, "tagBindings/{{parent}}")
260+
if err != nil {
261+
return err
262+
}
263+
transport_tpg.MutexStore.Lock(lockName)
264+
defer transport_tpg.MutexStore.Unlock(lockName)
265+
252266
url, err := tpgresource.ReplaceVars(d, config, "{{TagsLocationBasePath}}{{name}}")
253267
if err != nil {
254268
return err

0 commit comments

Comments
 (0)