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

Add mutex and retry for usage plan key #10092

Merged
merged 1 commit into from
Jan 13, 2021

Conversation

hieven
Copy link

@hieven hieven commented Sep 12, 2019

We have same issue as #483 while creating multiple associations between API key and usage plan with default concurrency: 10.

Hence we'd like to introduce mutex lock while creating such resource to prevent from concurrent modification error

As mutex lock couldn't help with simultaneous executions of Terraform from many developers, we also add retry logic.

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" comments, they generate extra noise for pull request followers and do not help prioritize the request

Relates #483

Release note for CHANGELOG:

Add mutex lock to prevent errors from concurrently creating usage plan key

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccXXX'

...

@hieven hieven requested a review from a team September 12, 2019 20:26
@ghost ghost added size/XS Managed by automation to categorize the size of a PR. service/apigateway Issues and PRs that pertain to the apigateway service. labels Sep 12, 2019
@ndajr
Copy link

ndajr commented Sep 19, 2019

I'm having the same problem, I created a repo reproducing that:
https://github.com/neemiasjnr/terraform-issue

@hieven
Copy link
Author

hieven commented Oct 2, 2019

Hi @Ninir,
Would you mind to leave some feedback regard this PR? Does introducing mutex lock still a valid solution for API Gateway concurrent modification error?

Similar issue #483 and PR #2393 before

Thanks

@arjunpunnam
Copy link

Team,
I am facing the same problem and seems like this would fix the issue.Could you please consider reviewing the pull request

@gertjangaillet
Copy link

@gdavison @bflad is this something that could be merged in the near future? We're also having this issue in a situation where we have a configurable amount of api keys to be linked to usage plans, so adding explicit dependencies does not work in our case -- and executing with parallellism 1 slows down our pipeline quite a lot...

@bflad bflad added the bug Addresses a defect in current functionality. label Jan 12, 2021
@bflad
Copy link
Contributor

bflad commented Jan 13, 2021

Hi folks 👋 After creating some additional testing for this resource that included concurrent aws_api_gateway_usage_plan_key resources, I was able to reproduce what appears to be the problem here. To speed things up in the future for the maintainers and get bug fixes in, it is helpful to ensure there is a covering issue that describes the problem including a reproducing configuration and typically debug logging.

In this case, we'll be taking a slightly different approach instead of a mutex where we introduce the retry logic directly into the AWS Go SDK service client since it will yield the simplest fix. Thank you @hieven for contributing this and that implementation will be refactored on top of this commit along with the covering testing. 👍

@bflad bflad merged commit 942b17d into hashicorp:master Jan 13, 2021
bflad added a commit that referenced this pull request Jan 13, 2021
bflad added a commit that referenced this pull request Jan 13, 2021
@ghost
Copy link

ghost commented Feb 12, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Feb 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/apigateway Issues and PRs that pertain to the apigateway service. size/XS Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants