Skip to content

Commit

Permalink
Merge pull request #39648 from pedrokiefer/aws_cloudwatch_event_rule
Browse files Browse the repository at this point in the history
fix: aws_cloudwatch_event_rule update with tags
  • Loading branch information
ewbankkit authored Oct 15, 2024
2 parents 7c94eab + eeb0f7f commit 606f1e9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/39648.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_cloudwatch_event_rule: Add tags to AWS API request on Update to support [ABAC `aws:RequestTag` conditions](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_tags.html#access_tags_control-requests)
```
8 changes: 8 additions & 0 deletions internal/service/events/rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,17 @@ func resourceRuleUpdate(ctx context.Context, d *schema.ResourceData, meta interf
}

input := expandPutRuleInput(d, ruleName)
input.Tags = getTagsIn(ctx) // For ABAC aws:RequestTag condition.

_, err = retryPutRule(ctx, conn, input)

// Some partitions (e.g. ISO) may not support tag-on-update.
if input.Tags != nil && errs.IsUnsupportedOperationInPartitionError(meta.(*conns.AWSClient).Partition, err) {
input.Tags = nil

_, err = retryPutRule(ctx, conn, input)
}

if err != nil {
return sdkdiag.AppendErrorf(diags, "updating EventBridge Rule (%s): %s", d.Id(), err)
}
Expand Down

0 comments on commit 606f1e9

Please sign in to comment.