Skip to content

fix(logs): use AccountPrincipal for drift prevention - #38420

Open
wasim-builds wants to merge 8 commits into
aws:mainfrom
wasim-builds:fix/aws-logs-account-principal
Open

fix(logs): use AccountPrincipal for drift prevention#38420
wasim-builds wants to merge 8 commits into
aws:mainfrom
wasim-builds:fix/aws-logs-account-principal

Conversation

@wasim-builds

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

Copy link
Copy Markdown

Issue

Closes #37797

What does this PR do?

Noticed a small bug causing false-positive CloudFormation drift alarms
because cross-account permissions were being written as raw account IDs
instead of ARNs. Swapped in AccountPrincipal to force the canonical ARN
format.

Testing

Tested locally and verified the output format matches the canonical ARN
format expected by CloudFormation.


By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache-2.0 license.

@github-actions github-actions Bot added p2 beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK labels Jul 27, 2026
@aws-cdk-automation
aws-cdk-automation requested a review from a team July 27, 2026 19:52

@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)

@github-actions github-actions Bot added bug This issue is a bug. effort/small Small work item – less than a day of effort labels Jul 27, 2026
@wasim-builds wasim-builds changed the title fix(aws-logs): use AccountPrincipal for drift prevention fix(logs): use AccountPrincipal for drift prevention Jul 27, 2026
@wasim-builds

Copy link
Copy Markdown
Author

Exemption Request

This is a minor, localized fix to swap ArnPrincipal for AccountPrincipal inside the log-group resource policy generation. This prevents CloudFormation drift by forcing the canonical ARN format. It only changes the string formatting in the synthesized CloudFormation template, which is fully covered by the unit test snapshots. Adding a new full integration test is unnecessary for this formatting change as it does not affect runtime application logic.

@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 27, 2026
@aws-cdk-automation aws-cdk-automation added the pr/needs-further-review PR requires additional review from our team specialists due to the scope or complexity of changes. label Jul 27, 2026
@aws-cdk-automation
aws-cdk-automation dismissed their stale review July 28, 2026 03:58

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

@wasim-builds

Copy link
Copy Markdown
Author

Hi! Following up on this — the AccountPrincipal fix for log-group drift prevention is small (+39/-7) and CI is passing. Would love a review when you have bandwidth!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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/needs-further-review PR requires additional review from our team specialists due to the scope or complexity of changes. 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

2 participants