Skip to content

Commit

Permalink
r/aws_glue_trigger: handle concurrent modification exceptions
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jar-b committed Nov 22, 2023
1 parent c6fd47f commit e812f36
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/34530.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_glue_trigger: Fix `ConcurrentModificationException: Workflow <workflowName> was modified while adding trigger <triggerName>` errors
```
6 changes: 6 additions & 0 deletions internal/service/glue/trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit e812f36

Please sign in to comment.