Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r/aws_cloudwatch_log_group: Use log group-specific tagging functions #28492

Merged
merged 3 commits into from
Dec 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changelog/28492.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```release-note:bug
resource/aws_cloudwatch_log_group: Restore use of `ListTagsLogGroup`, `TagLogGroup` and `UntagLogGroup` APIs
```

```release-note:bug
data-source/aws_cloudwatch_log_group: Restore use of `ListTagsLogGroup` API
```
1 change: 1 addition & 0 deletions internal/service/logs/generate.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//go:generate go run ../../generate/listpages/main.go -ListOps=DescribeQueryDefinitions,DescribeResourcePolicies
//go:generate go run ../../generate/tags/main.go -ListTags -ServiceTagsMap -UpdateTags
//go:generate go run ../../generate/tags/main.go -ListTags -ListTagsOp=ListTagsLogGroup -ListTagsInIDElem=LogGroupName -ListTagsFunc=ListLogGroupTags -TagOp=TagLogGroup -TagInIDElem=LogGroupName -UntagOp=UntagLogGroup -UntagInTagsElem=Tags -UpdateTags -UpdateTagsFunc=UpdateLogGroupTags -- log_group_tags_gen.go
// ONLY generate directives and package declaration! Do not add anything else to this file.

package logs
4 changes: 2 additions & 2 deletions internal/service/logs/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func resourceGroupRead(ctx context.Context, d *schema.ResourceData, meta interfa
d.Set("name_prefix", create.NamePrefixFromName(aws.StringValue(lg.LogGroupName)))
d.Set("retention_in_days", lg.RetentionInDays)

tags, err := ListTagsWithContext(ctx, conn, d.Get("arn").(string))
tags, err := ListLogGroupTagsWithContext(ctx, conn, d.Id())

if err != nil {
return diag.Errorf("listing tags for CloudWatch Logs Log Group (%s): %s", d.Id(), err)
Expand Down Expand Up @@ -203,7 +203,7 @@ func resourceGroupUpdate(ctx context.Context, d *schema.ResourceData, meta inter
if d.HasChange("tags_all") {
o, n := d.GetChange("tags_all")

if err := UpdateTagsWithContext(ctx, conn, d.Get("arn").(string), o, n); err != nil {
if err := UpdateLogGroupTagsWithContext(ctx, conn, d.Id(), o, n); err != nil {
return diag.Errorf("updating CloudWatch Logs Log Group (%s) tags: %s", d.Id(), err)
}
}
Expand Down
2 changes: 1 addition & 1 deletion internal/service/logs/group_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func dataSourceGroupRead(ctx context.Context, d *schema.ResourceData, meta inter
d.Set("kms_key_id", logGroup.KmsKeyId)
d.Set("retention_in_days", logGroup.RetentionInDays)

tags, err := ListTagsWithContext(ctx, conn, d.Get("arn").(string))
tags, err := ListLogGroupTagsWithContext(ctx, conn, name)

if err != nil {
return diag.Errorf("listing tags for CloudWatch Logs Log Group (%s): %s", name, err)
Expand Down
72 changes: 72 additions & 0 deletions internal/service/logs/log_group_tags_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.