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

API Gateway v2 integration & route: ConflictException due to concurrent modification #37897

Closed
bklein1 opened this issue Jun 10, 2024 · 6 comments · Fixed by #37902
Closed

API Gateway v2 integration & route: ConflictException due to concurrent modification #37897

bklein1 opened this issue Jun 10, 2024 · 6 comments · Fixed by #37902
Assignees
Labels
bug Addresses a defect in current functionality. service/apigatewayv2 Issues and PRs that pertain to the apigatewayv2 service.
Milestone

Comments

@bklein1
Copy link

bklein1 commented Jun 10, 2024

Terraform Core Version

1.5.5

AWS Provider Version

5.53.0

Affected Resource(s)

  • aws_apigatewayv2_integration
  • aws_apigatewayv2_route

Expected Behavior

Multiple routes should be added to a single integration without error.

Actual Behavior

When creating multiple routes a conflicting error pops up.

Relevant Error/Panic Output Snippet

Error: creating API Gateway v2 Route: operation error ApiGatewayV2: CreateRoute, https response error StatusCode: 409, ConflictException: Unable to complete operation due to concurrent modification. Please try again later.

Terraform Configuration Files

terraform {
  required_version = ">= 1.0.0, < 2.0.0"

  backend "local" {}

  required_providers {
    aws = {
      source  = "hashicorp/aws"
#       version = "= 5.44.0" // This version works!
      version = "= 5.53.0" // This version does not work
    }
    random = {
      source  = "hashicorp/random"
      version = ">= 3.6.0"
    }
    local = {
      source  = "hashicorp/local"
      version = ">= 2.0.0"
    }
  }
}

provider "aws" {
  region = "eu-central-1"
}


resource "aws_apigatewayv2_api" "api_gateway" {
  name             = "test-api-gw"
  protocol_type    = "HTTP"
  fail_on_warnings = true
}

resource "aws_apigatewayv2_integration" "api_gateway" {
  api_id             = aws_apigatewayv2_api.api_gateway.id
  integration_type   = "HTTP_PROXY"
  integration_method = "ANY"
  integration_uri    = "https://google.com"
}

resource "aws_apigatewayv2_route" "api_gateway_1" {
  api_id    = aws_apigatewayv2_api.api_gateway.id
  route_key = "ANY /key1"
  target    = "integrations/${aws_apigatewayv2_integration.api_gateway.id}"
}

resource "aws_apigatewayv2_route" "api_gateway_2" {
  api_id    = aws_apigatewayv2_api.api_gateway.id
  route_key = "ANY /key2"
  target    = "integrations/${aws_apigatewayv2_integration.api_gateway.id}"
}

resource "aws_apigatewayv2_route" "api_gateway_3" {
  api_id    = aws_apigatewayv2_api.api_gateway.id
  route_key = "ANY /key3"
  target    = "integrations/${aws_apigatewayv2_integration.api_gateway.id}"
}

resource "aws_apigatewayv2_route" "api_gateway_4" {
  api_id    = aws_apigatewayv2_api.api_gateway.id
  route_key = "ANY /key4"
  target    = "integrations/${aws_apigatewayv2_integration.api_gateway.id}"
}

resource "aws_apigatewayv2_route" "api_gateway_5" {
  api_id    = aws_apigatewayv2_api.api_gateway.id
  route_key = "ANY /key5"
  target    = "integrations/${aws_apigatewayv2_integration.api_gateway.id}"
}

Steps to Reproduce

  • Initialize with aws provider version 5.53.0
  • Apply changes
  • Error will occur
  • Destroy changes
  • Set version to 5.44.0
  • Apply changes --> This should work

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

This issue was already fixed once (see #18018). I searched through the files and found that this fix was deleted with this Pull Request: #36490

The file that contained the fix changed during time. But the latest file containing it was on path: internal/service/apigatewayv2/service_package.go

Would you like to implement a fix?

No

@bklein1 bklein1 added the bug Addresses a defect in current functionality. label Jun 10, 2024
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added the service/apigatewayv2 Issues and PRs that pertain to the apigatewayv2 service. label Jun 10, 2024
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Jun 10, 2024
@ewbankkit ewbankkit removed the needs-triage Waiting for first response or review from a maintainer. label Jun 10, 2024
@ewbankkit ewbankkit self-assigned this Jun 10, 2024
@terraform-aws-provider terraform-aws-provider bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Jun 10, 2024
@ewbankkit
Copy link
Contributor

Pre AWS SDK for Go v2 migration (v5.44.0):

// CustomizeConn customizes a new AWS SDK for Go v1 client for this service package's AWS API.
func (p *servicePackage) CustomizeConn(ctx context.Context, conn *apigatewayv2_sdkv1.ApiGatewayV2) (*apigatewayv2_sdkv1.ApiGatewayV2, error) {
conn.Handlers.Retry.PushBack(func(r *request_sdkv1.Request) {
// Many operations can return an error such as:
// ConflictException: Unable to complete operation due to concurrent modification. Please try again later.
// Handle them all globally for the service client.
if tfawserr.ErrMessageContains(r.Error, apigatewayv2_sdkv1.ErrCodeConflictException, "try again later") {
r.Retryable = aws_sdkv1.Bool(true)
}
})
return conn, nil
}

@ewbankkit
Copy link
Contributor

Relates #37732.

Copy link

Warning

This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

@github-actions github-actions bot added this to the v5.54.0 milestone Jun 10, 2024
@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Jun 14, 2024
Copy link

This functionality has been released in v5.54.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

Copy link

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 15, 2024
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/apigatewayv2 Issues and PRs that pertain to the apigatewayv2 service.
Projects
None yet
2 participants