From eacac5781b5e7bc8cbdbc1c58a84a2e4ee4c4c59 Mon Sep 17 00:00:00 2001 From: Filip Zjalic <118170660+zjalicf-cyberlab@users.noreply.github.com> Date: Wed, 1 Mar 2023 10:17:11 +0100 Subject: [PATCH 1/4] adding apigatewayv2 and error handling --- internal/conns/config.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/internal/conns/config.go b/internal/conns/config.go index 89ce54fc36e..f4d5f7b07c7 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" @@ -266,6 +267,16 @@ func (c *Config) ConfigureProvider(ctx context.Context, client *AWSClient) (*AWS r.Retryable = aws.Bool(true) } }) + + //Potential fix for https://github.com/hashicorp/terraform-provider-aws/issues/18018 + 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) { From 8fc35f0446b647b4b78d808c235f4dbe1f3f234a Mon Sep 17 00:00:00 2001 From: Filip Zjalic <118170660+zjalicf-cyberlab@users.noreply.github.com> Date: Wed, 1 Mar 2023 10:58:06 +0100 Subject: [PATCH 2/4] Create 29735.txt --- .changelog/29735.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/29735.txt diff --git a/.changelog/29735.txt b/.changelog/29735.txt new file mode 100644 index 00000000000..d2a9223f123 --- /dev/null +++ b/.changelog/29735.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_apigatewayv2_integration: Fix ConflictException: Unable to complete operation due to concurrent modification. +``` From 9950f1ef031b7b920dfb855aa1bb5c429571f968 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Fri, 10 Mar 2023 10:20:01 -0500 Subject: [PATCH 3/4] Tweak CHANGELOG entry. --- .changelog/29735.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changelog/29735.txt b/.changelog/29735.txt index d2a9223f123..b35971db283 100644 --- a/.changelog/29735.txt +++ b/.changelog/29735.txt @@ -1,3 +1,3 @@ ```release-note:bug -resource/aws_apigatewayv2_integration: Fix ConflictException: Unable to complete operation due to concurrent modification. +resource/aws_apigatewayv2_integration: Retry errors like `ConflictException: Unable to complete operation due to concurrent modification. Please try again later.` ``` From 5aed50fda59852f10ee90edfea9bd5570f146c77 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Fri, 10 Mar 2023 10:23:30 -0500 Subject: [PATCH 4/4] Cosmetics. --- internal/conns/config.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/internal/conns/config.go b/internal/conns/config.go index f4d5f7b07c7..f19857d8a70 100644 --- a/internal/conns/config.go +++ b/internal/conns/config.go @@ -267,8 +267,7 @@ func (c *Config) ConfigureProvider(ctx context.Context, client *AWSClient) (*AWS r.Retryable = aws.Bool(true) } }) - - //Potential fix for https://github.com/hashicorp/terraform-provider-aws/issues/18018 + 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.