From 2f0729c4938f844056f04007af8ebdeadd4788ca Mon Sep 17 00:00:00 2001 From: Angie Pinilla Date: Fri, 25 Mar 2022 14:32:24 -0400 Subject: [PATCH 1/2] r/lambda_function: add ResourceConflictException error handling on create and update --- internal/service/lambda/function.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/service/lambda/function.go b/internal/service/lambda/function.go index 88f48d7ee36..2613ed92d50 100644 --- a/internal/service/lambda/function.go +++ b/internal/service/lambda/function.go @@ -553,6 +553,11 @@ func resourceFunctionCreate(d *schema.ResourceData, meta interface{}) error { return resource.RetryableError(err) } + if tfawserr.ErrCodeEquals(err, lambda.ErrCodeResourceConflictException) { + log.Printf("[DEBUG] Received %s, retrying CreateFunction", err) + return resource.RetryableError(err) + } + if err != nil { return resource.NonRetryableError(err) } @@ -1097,6 +1102,11 @@ func resourceFunctionUpdate(d *schema.ResourceData, meta interface{}) error { return resource.RetryableError(err) } + if tfawserr.ErrCodeEquals(err, lambda.ErrCodeResourceConflictException) { + log.Printf("[DEBUG] Received %s, retrying UpdateFunctionConfiguration", err) + return resource.RetryableError(err) + } + if err != nil { return resource.NonRetryableError(err) } From 41b833fa98fd4e0d52e9cf6253b0cf9544c11d14 Mon Sep 17 00:00:00 2001 From: Angie Pinilla Date: Fri, 25 Mar 2022 14:38:34 -0400 Subject: [PATCH 2/2] Update CHANGELOG for #23879 --- .changelog/23879.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/23879.txt diff --git a/.changelog/23879.txt b/.changelog/23879.txt new file mode 100644 index 00000000000..cb5d194cd4a --- /dev/null +++ b/.changelog/23879.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/aws_lambda_function: Add error handling for `ResourceConflictException` errors on create and update +``` \ No newline at end of file