Skip to content

Commit b5fbaa9

Browse files
add mutex for apigee_instance (#5701) (#11121)
* Add support IAM policy for the Environment of Apigee X * Add support IAM policy for the Environment of Apigee X * Add support IAM policy for the Environment of Apigee X * Add support IAM policy for the Environment of Apigee X * Revert all changes to test files. * Revert all changes to test files. * Revert all changes to test files. * Add primary_resource_name to fix tests. * Update iam_attributes.tf.erb to honor skip_test. * Don't reject skip_tests when example is nil. * Update mmv1/products/apigee/api.yaml Co-authored-by: Stephen Lewis (Burrows) <[email protected]> * Fix primary_resource_name for apigee organization name. * add mutex for apigee_instance * Add mutex for apigee_instance 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 bf08e2d commit b5fbaa9

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

.changelog/5701.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
apigee: fixed a bug where multiple `google_apigee_instance` could not be used on the same `google_apigee_organization`
3+
```

google/resource_apigee_instance.go

+14
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,13 @@ func resourceApigeeInstanceCreate(d *schema.ResourceData, meta interface{}) erro
166166
obj["diskEncryptionKeyName"] = diskEncryptionKeyNameProp
167167
}
168168

169+
lockName, err := replaceVars(d, config, "{{org_id}}/apigeeInstances")
170+
if err != nil {
171+
return err
172+
}
173+
mutexKV.Lock(lockName)
174+
defer mutexKV.Unlock(lockName)
175+
169176
url, err := replaceVars(d, config, "{{ApigeeBasePath}}{{org_id}}/instances")
170177
if err != nil {
171178
return err
@@ -280,6 +287,13 @@ func resourceApigeeInstanceDelete(d *schema.ResourceData, meta interface{}) erro
280287

281288
billingProject := ""
282289

290+
lockName, err := replaceVars(d, config, "{{org_id}}/apigeeInstances")
291+
if err != nil {
292+
return err
293+
}
294+
mutexKV.Lock(lockName)
295+
defer mutexKV.Unlock(lockName)
296+
283297
url, err := replaceVars(d, config, "{{ApigeeBasePath}}{{org_id}}/instances/{{name}}")
284298
if err != nil {
285299
return err

0 commit comments

Comments
 (0)