Skip to content

fix(logs): include log group ARN in LogGroup.grant() and grantRead() - #39559

Draft
1992chenlu wants to merge 9 commits into
aws:mainfrom
1992chenlu:fix/log-group-grant-arn
Draft

1992chenlu wants to merge 9 commits into
aws:mainfrom
1992chenlu:fix/log-group-grant-arn

Conversation

@1992chenlu

@1992chenlu 1992chenlu commented Oct 29, 2026 •

Copy link
Copy Markdown

Issue # (if applicable)

Closes #39561.

Reason for this change

LogGroup.grant() and LogGroup.grantRead() / LogGroupGrants.read() only used the log group ARN ending in :*. Statements created by them should also cover the plain log group ARN.

Description of changes

grant() and read() now pass two resource ARNs: the plain log group ARN and the existing :* ARN. The plain ARN is built from the log group name for owned log groups and imported-by-name log groups, and derived from the given ARN for log groups imported by ARN. It also works for LogGroupGrants.fromLogGroup(<CfnLogGroup>). To support this, LogGroupGrants is now hand-written (aws-logs/lib/log-group-grants.ts) instead of generated from grants.json; its public API is unchanged.

Describe any new or updated permissions being added

Statements generated by LogGroup.grant() and LogGroup.grantRead() now list the plain log group ARN in addition to the :* ARN.

Description of how you validated changes

  • Added unit tests for owned, fromLogGroupName, fromLogGroupArn and L1 log groups, for both grant() and read().
  • Updated unit tests in aws-stepfunctions-tasks and aws-iot-actions-alpha that assert on grant() output.
  • Ran yarn build and yarn compat for aws-cdk-lib.
  • Added an integ test for LogGroup.grant() and re-ran and updated the affected integ snapshots (emrcontainers job-submission-workflow, iot cloudwatch-logs-action, loggroup-grantread) with a real deployment.

Checklist

  • My code adheres to the CONTRIBUTING GUIDE and DESIGN GUIDELINES

@github-actions github-actions Bot added the p2 label Oct 29, 2026
@github-actions github-actions Bot added the beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK label Oct 29, 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)

@aws-cdk-automation
aws-cdk-automation dismissed their stale review October 29, 2026 21:22

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

Include the log group ARN, in addition to the log stream ARN (":*"), in the
resources used by LogGroupGrants.read() and LogGroup.grantRead(), including
for L1 log groups.
@1992chenlu 1992chenlu changed the title fix(logs): include log group ARN in LogGroup.grant() fix(logs): include log group ARN in LogGroup.grant() and grantRead() Oct 30, 2026
@github-actions github-actions Bot added effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. labels Oct 30, 2026

This branch was previously deployed

1 inactive deployment
automation — 7bd7d86e Deployed Oct 30, 2026 by 1992chenlu via validate-pr #375711
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 effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(logs): LogGroup.grant() and grantRead() do not include the log group ARN

2 participants