Skip to content

Commit

Permalink
add mutex for apigee_instance (#5701) (#11121)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
modular-magician and melinath authored Feb 16, 2022
1 parent bf08e2d commit b5fbaa9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/5701.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
apigee: fixed a bug where multiple `google_apigee_instance` could not be used on the same `google_apigee_organization`
```
14 changes: 14 additions & 0 deletions google/resource_apigee_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,13 @@ func resourceApigeeInstanceCreate(d *schema.ResourceData, meta interface{}) erro
obj["diskEncryptionKeyName"] = diskEncryptionKeyNameProp
}

lockName, err := replaceVars(d, config, "{{org_id}}/apigeeInstances")
if err != nil {
return err
}
mutexKV.Lock(lockName)
defer mutexKV.Unlock(lockName)

url, err := replaceVars(d, config, "{{ApigeeBasePath}}{{org_id}}/instances")
if err != nil {
return err
Expand Down Expand Up @@ -280,6 +287,13 @@ func resourceApigeeInstanceDelete(d *schema.ResourceData, meta interface{}) erro

billingProject := ""

lockName, err := replaceVars(d, config, "{{org_id}}/apigeeInstances")
if err != nil {
return err
}
mutexKV.Lock(lockName)
defer mutexKV.Unlock(lockName)

url, err := replaceVars(d, config, "{{ApigeeBasePath}}{{org_id}}/instances/{{name}}")
if err != nil {
return err
Expand Down

0 comments on commit b5fbaa9

Please sign in to comment.