diff --git a/.changelog/29735.txt b/.changelog/29735.txt new file mode 100644 index 00000000000..b35971db283 --- /dev/null +++ b/.changelog/29735.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_apigatewayv2_integration: Retry errors like `ConflictException: Unable to complete operation due to concurrent modification. Please try again later.` +``` diff --git a/internal/conns/config.go b/internal/conns/config.go index 89ce54fc36e..f19857d8a70 100644 --- a/internal/conns/config.go +++ b/internal/conns/config.go @@ -11,6 +11,7 @@ import ( "github.com/aws/aws-sdk-go/aws/endpoints" "github.com/aws/aws-sdk-go/aws/request" "github.com/aws/aws-sdk-go/service/apigateway" + "github.com/aws/aws-sdk-go/service/apigatewayv2" "github.com/aws/aws-sdk-go/service/appconfig" "github.com/aws/aws-sdk-go/service/applicationautoscaling" "github.com/aws/aws-sdk-go/service/appsync" @@ -267,6 +268,15 @@ func (c *Config) ConfigureProvider(ctx context.Context, client *AWSClient) (*AWS } }) + client.apigatewayv2Conn.Handlers.Retry.PushBack(func(r *request.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.ErrCodeConflictException, "try again later") { + r.Retryable = aws.Bool(true) + } + }) + // Workaround for https://github.com/aws/aws-sdk-go/issues/1472 client.applicationautoscalingConn.Handlers.Retry.PushBack(func(r *request.Request) { if !strings.HasPrefix(r.Operation.Name, "Describe") && !strings.HasPrefix(r.Operation.Name, "List") {