Skip to content

Commit

Permalink
Merge pull request #36286 from moonorange/f-aws_iot_topic_rule_update…
Browse files Browse the repository at this point in the history
…_retry

Retry Updating an aws_iot_topic_rule resource on temporary IAM exception
  • Loading branch information
ewbankkit authored Jul 3, 2024
2 parents 1a86c28 + 43d5c83 commit 09df920
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/36286.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_iot_topic_rule: Retry IAM eventual consistency errors on Update
```
5 changes: 4 additions & 1 deletion internal/service/iot/topic_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -1379,7 +1379,10 @@ func resourceTopicRuleUpdate(ctx context.Context, d *schema.ResourceData, meta i
TopicRulePayload: expandTopicRulePayload(d),
}

_, err := conn.ReplaceTopicRule(ctx, input)
_, err := tfresource.RetryWhenIsA[*awstypes.InvalidRequestException](ctx, propagationTimeout,
func() (interface{}, error) {
return conn.ReplaceTopicRule(ctx, input)
})

if err != nil {
return sdkdiag.AppendErrorf(diags, "replacing IoT Topic Rule (%s): %s", d.Id(), err)
Expand Down

0 comments on commit 09df920

Please sign in to comment.