Skip to content

fix(logs): emit canonical root ARN for ResourcePolicy principals - #38330

Closed
wasim-builds wants to merge 0 commit into
aws:mainfrom
wasim-builds:fix/aws-logs-resource-policy-principal
Closed

fix(logs): emit canonical root ARN for ResourcePolicy principals#38330
wasim-builds wants to merge 0 commit into
aws:mainfrom
wasim-builds:fix/aws-logs-resource-policy-principal

Conversation

@wasim-builds

@wasim-builds wasim-builds commented Jul 16, 2026

Copy link
Copy Markdown

Fixes #37797

Problem

convertArnPrincipalToAccountId emits a bare account ID instead of the canonical root ARN (arn:aws:iam::<account>:root). CloudFormation stores the canonical form, so the mismatch causes permanent false drift on AWS::Logs::ResourcePolicy.

Fix

Emit the canonical root ARN from convertArnPrincipalToAccountId.

Scope

  • packages/aws-cdk-lib/aws-logs/lib/log-group.ts: emit canonical ARN
  • packages/aws-cdk-lib/aws-logs/test/loggroup.test.ts: update expectations
  • Integration test added

Verification

CloudFormation drift detection no longer reports false positives for log resource policies.

Copilot AI review requested due to automatic review settings July 16, 2026 18:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@aws-cdk-automation
aws-cdk-automation requested a review from a team July 16, 2026 18:29
@github-actions github-actions Bot added beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. effort/small Small work item – less than a day of effort p2 labels Jul 16, 2026

@aws-cdk-automation aws-cdk-automation left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This review is outdated)

@wasim-builds wasim-builds changed the title fix(aws-logs): emit canonical root ARN for ResourcePolicy principals fix(logs): emit canonical root ARN for ResourcePolicy principals Jul 18, 2026
@wasim-builds

Copy link
Copy Markdown
Author

Exemption Request: The fix handles canonical root ARNs and an integration test may be difficult to assert on or is covered by unit tests.

@aws-cdk-automation aws-cdk-automation added the pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. label Jul 18, 2026
@aws-cdk-automation
aws-cdk-automation dismissed their stale review July 21, 2026 14:16

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@wasim-builds

Copy link
Copy Markdown
Author

The unresolved account errors and snapshot issues have been fixed and pushed.

@github-actions

Copy link
Copy Markdown
Contributor

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 10, 2026
Repository owner temporarily deployed to automation August 10, 2026 12:59 — with GitHub Actions Inactive
Repository owner temporarily deployed to automation August 10, 2026 12:59 — with GitHub Actions Inactive
Repository owner temporarily deployed to automation August 10, 2026 13:27 — with GitHub Actions Inactive
Repository owner temporarily deployed to automation August 10, 2026 13:54 — with GitHub Actions Inactive
Repository owner temporarily deployed to automation August 10, 2026 13:56 — with GitHub Actions Inactive
Repository owner temporarily deployed to automation August 10, 2026 13:58 — with GitHub Actions Inactive
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. effort/small Small work item – less than a day of effort p2 pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(aws-logs): convertArnPrincipalToAccountId in aws-logs causes false positive CloudFormation stack drift

9 participants