Skip to content

fix: IAM Policy 409 concurrent changes error - take 2#15995

Merged
slevenick merged 5 commits intoGoogleCloudPlatform:mainfrom
tamir-deep:fix/25305-take2
Feb 13, 2026
Merged

fix: IAM Policy 409 concurrent changes error - take 2#15995
slevenick merged 5 commits intoGoogleCloudPlatform:mainfrom
tamir-deep:fix/25305-take2

Conversation

@tamir-deep
Copy link
Contributor

Fixes hashicorp/terraform-provider-google#25305

There is already a backoff retry mechanism but it's broken due to wrapped error. The current usage for checking if it's googleapi error doesn't work well.

#15972 reverted #15825 due to regressions. However, the original IAM 409 concurrent error is now back due to that.

I debugged that specific error and found that the err var returned is by the type fmt.Errorf on level 0 and googleapi.Error on level 1.
errwrap simply doesn't detect it.

I wanted to avoid walking or unwrapping and make minimal changes as possible.

Given the fact we have to keep using errwrap for now, I added the same changes I did originally below the current errwrap code and also I added tests.

I tested the generated provider and it solves the 409 issue.

Tagging @slevenick @ScottSuarez @BBBmau for extra verification and input.

Release Note Template for Downstream PRs (will be copied)

See Write release notes for guidance.

iam: fixed error 409 concurrency policy changes by correctly detecting the error type.

@modular-magician modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Dec 18, 2025
@github-actions github-actions bot requested a review from slevenick December 18, 2025 20:54
@github-actions
Copy link

Hello! I am a robot. Tests will require approval from a repository maintainer to run.

Googlers: For automatic test runs see go/terraform-auto-test-runs.

@slevenick, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look.

You can help make sure that review is quick by doing a self-review and by running impacted tests locally.

@github-actions
Copy link

@slevenick This PR has been waiting for review for 3 weekdays. Please take a look! Use the label disable-review-reminders to disable these notifications.

@github-actions
Copy link

@GoogleCloudPlatform/terraform-team @slevenick This PR has been waiting for review for 1 week. Please take a look! Use the label disable-review-reminders to disable these notifications.

@github-actions
Copy link

github-actions bot commented Jan 1, 2026

@GoogleCloudPlatform/terraform-team @slevenick This PR has been waiting for review for 2 weeks. Please take a look! Use the label disable-review-reminders to disable these notifications.

@github-actions
Copy link

github-actions bot commented Jan 8, 2026

@GoogleCloudPlatform/terraform-team @slevenick This PR has been waiting for review for 3 weeks. Please take a look! Use the label disable-review-reminders to disable these notifications.

@tamir-deep
Copy link
Contributor Author

@slevenick Can you take a look please?

@tamir-deep tamir-deep marked this pull request as draft January 15, 2026 08:38
@tamir-deep tamir-deep marked this pull request as ready for review January 15, 2026 08:38
@github-actions
Copy link

@slevenick This PR has been waiting for review for 3 weekdays. Please take a look! Use the label disable-review-reminders to disable these notifications.

Copy link
Contributor

@slevenick slevenick left a comment

Choose a reason for hiding this comment

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

I think this is a better approach and shouldn't have the impact of the previous change. I'm going to get another pair of eyes on this as it's such a core part of shared provider functionality

@tamir-deep
Copy link
Contributor Author

Sure thing

@github-actions github-actions bot requested a review from slevenick January 21, 2026 08:13
@github-actions
Copy link

@slevenick This PR has been waiting for review for 3 weekdays. Please take a look! Use the label disable-review-reminders to disable these notifications.

@github-actions
Copy link

@GoogleCloudPlatform/terraform-team @slevenick This PR has been waiting for review for 1 week. Please take a look! Use the label disable-review-reminders to disable these notifications.

@github-actions
Copy link

github-actions bot commented Feb 4, 2026

@GoogleCloudPlatform/terraform-team @slevenick This PR has been waiting for review for 2 weeks. Please take a look! Use the label disable-review-reminders to disable these notifications.

@tamir-deep
Copy link
Contributor Author

@slevenick got a chance to have someone else look at it? Seems like the bot assigned you again

@github-actions github-actions bot requested a review from slevenick February 10, 2026 07:21
Copy link
Contributor

@slevenick slevenick left a comment

Choose a reason for hiding this comment

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

Thanks!

@modular-magician modular-magician removed the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Feb 10, 2026
@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 2 files changed, 12 insertions(+), 1 deletion(-))
google-beta provider: Diff ( 2 files changed, 12 insertions(+), 1 deletion(-))
terraform-google-conversion: Diff ( 1 file changed, 5 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 6011
Passed tests: 5376
Skipped tests: 634
Affected tests: 1

Click here to see the affected service packages

All service packages are affected

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccAccessContextManager__service_perimeter_dry_run_egress_policy

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccAccessContextManager__access_level [Debug log]
TestAccAccessContextManager__access_level_condition [Debug log]
TestAccAccessContextManager__access_level_custom [Debug log]
TestAccAccessContextManager__access_level_full [Debug log]
TestAccAccessContextManager__access_levels [Debug log]
TestAccAccessContextManager__access_policy [Debug log]
TestAccAccessContextManager__access_policy_scoped [Debug log]
TestAccAccessContextManager__authorized_orgs_desc [Debug log]
TestAccAccessContextManager__service_perimeter [Debug log]
TestAccAccessContextManager__service_perimeter_dry_run_egress_policy [Debug log]
TestAccAccessContextManager__service_perimeter_dry_run_ingress_policy [Debug log]
TestAccAccessContextManager__service_perimeter_update [Debug log]
TestAccAccessContextManager__service_perimeters [Debug log]

🔴 Tests failed when rerunning REPLAYING mode:
TestAccAccessContextManager__service_perimeter_dry_run_egress_policy [Error message] [Debug log]
TestAccAccessContextManager__service_perimeter_dry_run_ingress_policy [Error message] [Debug log]

Tests failed due to non-determinism or randomness when the VCR replayed the response after the HTTP request was made.

Please fix these to complete your PR. If you believe these test failures to be incorrect or unrelated to your change, or if you have any questions, please raise the concern with your reviewer.


🟢 All tests passed!

View the build log or the debug log for each test

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.

Error 409 setting IAM policy for artifactregistry repository - There were concurrent policy changes

3 participants