From e812f3605979f2b2fa9934d205ccc49e37c9d457 Mon Sep 17 00:00:00 2001 From: Jared Baker Date: Wed, 22 Nov 2023 15:11:34 -0500 Subject: [PATCH] r/aws_glue_trigger: handle concurrent modification exceptions This change will retry trigger creation when a ConcurrentModificationException is received. This can occur when multiple triggers reference a single workflow within the same configuration. --- .changelog/34530.txt | 3 +++ internal/service/glue/trigger.go | 6 ++++++ 2 files changed, 9 insertions(+) create mode 100644 .changelog/34530.txt diff --git a/.changelog/34530.txt b/.changelog/34530.txt new file mode 100644 index 00000000000..4e1e22cd7f1 --- /dev/null +++ b/.changelog/34530.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_glue_trigger: Fix `ConcurrentModificationException: Workflow was modified while adding trigger ` errors +``` diff --git a/internal/service/glue/trigger.go b/internal/service/glue/trigger.go index b7da9473eaa..d6aeff8a86b 100644 --- a/internal/service/glue/trigger.go +++ b/internal/service/glue/trigger.go @@ -258,13 +258,19 @@ func resourceTriggerCreate(ctx context.Context, d *schema.ResourceData, meta int if v, ok := d.GetOk("start_on_creation"); ok { input.StartOnCreation = aws.Bool(v.(bool)) } + log.Printf("[DEBUG] Creating Glue Trigger: %s", input) err := retry.RetryContext(ctx, propagationTimeout, func() *retry.RetryError { _, err := conn.CreateTriggerWithContext(ctx, input) if err != nil { + // Retry IAM propagation errors if tfawserr.ErrMessageContains(err, glue.ErrCodeInvalidInputException, "Service is unable to assume provided role") { return retry.RetryableError(err) } + // Retry concurrent workflow modification errors + if tfawserr.ErrMessageContains(err, glue.ErrCodeConcurrentModificationException, "was modified while adding trigger") { + return retry.RetryableError(err) + } return retry.NonRetryableError(err) }