From b255a2245fb70cc852c0fa009f453e41939246ac Mon Sep 17 00:00:00 2001 From: Pedro Kiefer Date: Wed, 9 Oct 2024 16:45:23 -0300 Subject: [PATCH 1/3] fix: aws_cloudwatch_event_rule update with tags --- internal/service/events/rule.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/service/events/rule.go b/internal/service/events/rule.go index 741d78e2866..836132c8051 100644 --- a/internal/service/events/rule.go +++ b/internal/service/events/rule.go @@ -258,9 +258,17 @@ func resourceRuleUpdate(ctx context.Context, d *schema.ResourceData, meta interf } input := expandPutRuleInput(d, ruleName) + input.Tags = getTagsIn(ctx) _, err = retryPutRule(ctx, conn, input) + // Some partitions (e.g. ISO) may not support tag-on-create. + 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) } From cf83f36153637417bd03ee55a469ae4fd47cade6 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 15 Oct 2024 10:28:35 -0400 Subject: [PATCH 2/3] Cosmetics. --- internal/service/events/rule.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/events/rule.go b/internal/service/events/rule.go index 836132c8051..0fe22b8cf1b 100644 --- a/internal/service/events/rule.go +++ b/internal/service/events/rule.go @@ -258,11 +258,11 @@ func resourceRuleUpdate(ctx context.Context, d *schema.ResourceData, meta interf } input := expandPutRuleInput(d, ruleName) - input.Tags = getTagsIn(ctx) + input.Tags = getTagsIn(ctx) // For ABAC aws:RequestTag condition. _, err = retryPutRule(ctx, conn, input) - // Some partitions (e.g. ISO) may not support tag-on-create. + // 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 From eeb0f7f06bdd7e79c76afe561e312ee0d3170177 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 15 Oct 2024 10:32:14 -0400 Subject: [PATCH 3/3] Add CHANGELOG entry. --- .changelog/39648.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/39648.txt diff --git a/.changelog/39648.txt b/.changelog/39648.txt new file mode 100644 index 00000000000..c6080b4c458 --- /dev/null +++ b/.changelog/39648.txt @@ -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) +``` \ No newline at end of file