fix: strip :* suffix from log group ARN before listing tags#1151
fix: strip :* suffix from log group ARN before listing tags#1151james00012 wants to merge 2 commits into
Conversation
DescribeLogGroups returns CloudWatch Log Group ARNs with a trailing :* suffix, but ListTagsForResource rejects that form with Invalid resourceArn. The error was caught and the log group silently skipped, so no matching log groups were ever deleted. Strip the suffix before the tags call. Fixes #1150
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
Walkthrough
ChangesCloudWatch Log Group ARN suffix fix
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Prefer the suffix-free LogGroupArn field that AWS provides for tagging-API resourceArn, falling back to a trimmed Arn only when it is absent. Raise the tag-list failure log from Debug to Warn so skipped log groups are no longer silent, and cover both the fallback and the skip-on-error paths in tests.
Fixes #1150
Problem
cloudwatch-loggroupsilently deletes nothing.DescribeLogGroupsreturns theArnfield with a trailing:*suffix (e.g.arn:aws:logs:us-east-1:123:log-group:/aws/eks/x:*), butListTagsForResourcerejects that form withValidationException: Invalid resourceArn. The error was caught and the log group skipped viacontinue, so no matching log group was ever returned for deletion. Regression introduced in #1103, which added the tag-listing call.Fix
LogGroupArnfield, which AWS returns without the:*suffix specifically for the tagging-APIresourceArn, falling back to a trimmedArnonly whenLogGroupArnis absent.Testing
TestListCloudWatchLogGroups_TagInclusionFiltercovers both theLogGroupArnpath and theArnfallback. The mock now rejects any:*-suffixed ARN, so a regression to the unnormalized ARN fails the suite.TestListCloudWatchLogGroups_SkipsOnTagListErrorcovers the skip-on-error path.Invalid resourceArnfor every log group and finds none; the fixed binary finds and deletes the target group.Summary by CodeRabbit
Release Notes