Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update mutex on google_apigee_instance_attachment to lock globally #5911

Merged
merged 34 commits into from
Apr 11, 2022

Conversation

xuchenma
Copy link
Contributor

@xuchenma xuchenma commented Apr 7, 2022

This PR updates the mutex on google_apigee_instance_attachment to create a global lock.
It solves hashicorp/terraform-provider-google#11445.

If this PR is for Terraform, I acknowledge that I have:

  • Searched through the issue tracker for an open issue that this either resolves or contributes to, commented on it to claim it, and written "fixes {url}" or "part of {url}" in this PR description. If there were no relevant open issues, I opened one and commented that I would like to work on it (not necessary for very small changes).
  • Generated Terraform, and ran make test and make lint to ensure it passes unit and linter tests.
  • Ensured that all new fields I added that can be set by a user appear in at least one example (for generated resources) or third_party test (for handwritten resources or update tests).
  • Ran relevant acceptance tests (If the acceptance tests do not yet pass or you are unable to run them, please let your reviewer know).
  • Read the Release Notes Guide before writing my release note below.

Release Note Template for Downstream PRs (will be copied)

Update mutex on google_apigee_instance_attachment to lock on org_id.

xuchenma and others added 30 commits October 3, 2021 07:17
Co-authored-by: Stephen Lewis (Burrows) <[email protected]>
@modular-magician
Copy link
Collaborator

Hello! I am a robot who works on Magic Modules PRs.

I have detected that you are a community contributor, so your PR will be assigned to someone with a commit-bit on this repo for initial review.

Thanks for your contribution! A human will be with you soon.

@melinath, please review this PR or find an appropriate assignee.

@xuchenma
Copy link
Contributor Author

xuchenma commented Apr 7, 2022

I tested locally and it has worked. I cannot add a test case as in hashicorp/terraform-provider-google#11445 because only paid ApigeeOrgs can create multiple instances, and paid ApigeeOrgs cannot be automatically created/deleted in CI/CD tests.

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 1 file changed, 2 insertions(+), 2 deletions(-))
Terraform Beta: Diff ( 1 file changed, 2 insertions(+), 2 deletions(-))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 1971
Passed tests 1731
Skipped tests: 237
Failed tests: 3

Action taken

Triggering VCR tests in RECORDING mode for the following tests that failed during VCR: TestAccAccessContextManager|TestAccContainerCluster_withAuthenticatorGroupsConfig|TestAccComputeGlobalForwardingRule_externalCdnLbWithBackendBucketExample

@modular-magician
Copy link
Collaborator

Tests failed during RECORDING mode:
TestAccAccessContextManager[view]
TestAccComputeGlobalForwardingRule_externalCdnLbWithBackendBucketExample[view]
TestAccContainerCluster_withAuthenticatorGroupsConfig[view]

Please fix these to complete your PR
View the build log or the debug log for each test

@melinath
Copy link
Member

melinath commented Apr 8, 2022

@xuchenma I don't think this is going to do exactly what you want it to. The mutex will be filled in by getting the {{org_id}} field from the terraform resource - but google_apigee_instance_attachment doesn't have that field. That means the mutex will end up being on an empty string. This does resolve the issue that you identified, but it does it by creating a global lock on instance attachments - not a lock per organization.

Unfortunately there may not be a better solution than a global lock, since the terraform resource only has access to organization and environment. (But it would be better to make that explicit by giving it a hardcoded string as the mutex.)

@xuchenma xuchenma changed the title Update mutex on google_apigee_instance_attachment to lock on org_id Update mutex on google_apigee_instance_attachment to lock globally Apr 9, 2022
@xuchenma
Copy link
Contributor Author

xuchenma commented Apr 9, 2022

I see, thanks for the explanation! I updated it to lock on a hardcoded string. Tested locally, it worked for me.

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 1 file changed, 2 insertions(+), 2 deletions(-))
Terraform Beta: Diff ( 1 file changed, 2 insertions(+), 2 deletions(-))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 1971
Passed tests 1730
Skipped tests: 238
Failed tests: 3

Action taken

Triggering VCR tests in RECORDING mode for the following tests that failed during VCR: TestAccFirebaserulesRelease_BasicRelease|TestAccComputeForwardingRule_update|TestAccDatasourceGoogleServiceNetworkingPeeredDnsDomain_basic

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccDatasourceGoogleServiceNetworkingPeeredDnsDomain_basic[view]
TestAccFirebaserulesRelease_BasicRelease[view]
TestAccComputeForwardingRule_update[view]

All tests passed
View the build log or the debug log for each test

Copy link
Member

@melinath melinath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be good to add the resource name to the global mutex name; for now I think this is the only one but we should still namespace it to be future-proof.

@xuchenma
Copy link
Contributor Author

Got it, updated!

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 1 file changed, 2 insertions(+), 2 deletions(-))
Terraform Beta: Diff ( 1 file changed, 2 insertions(+), 2 deletions(-))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 1971
Passed tests 1731
Skipped tests: 238
Failed tests: 2

Action taken

Triggering VCR tests in RECORDING mode for the following tests that failed during VCR: TestAccFirebaserulesRelease_BasicRelease|TestAccServiceNetworkingPeeredDNSDomain_basic

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccFirebaserulesRelease_BasicRelease[view]
TestAccServiceNetworkingPeeredDNSDomain_basic[view]

All tests passed
View the build log or the debug log for each test

@melinath melinath merged commit f98721d into GoogleCloudPlatform:main Apr 11, 2022
@xuchenma xuchenma deleted the envlock branch April 12, 2022 21:45
betsy-lichtenberg pushed a commit to betsy-lichtenberg/magic-modules that referenced this pull request Apr 25, 2022
…oogleCloudPlatform#5911)

* 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.

* Update mutex on google_apigee_instance_attachment to lock on org_id.

* Create a global lock on instance attachments.

* update mutex name to apigeeInstanceAttachments

Co-authored-by: Stephen Lewis (Burrows) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants