You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
(logs): LogGroup.grant() and grantRead() do not include the log group ARN #39561
LogGroup.grant() and LogGroup.grantRead() use only the log group ARN that ends in :* as the resource of the generated statement. The plain log group ARN is not included.
Expected Behavior
Statements created by LogGroup.grant() and LogGroup.grantRead() list both the plain log group ARN (arn:<partition>:logs:<region>:<account>:log-group:<name>) and the :* ARN.
Current Behavior
Only arn:<partition>:logs:<region>:<account>:log-group:<name>:* is listed.
┌──────────────────────────────┐ ┌──────────────────────────────┐
│ LogGroup.grant(role, │ ──> │ IAM statement gets only the │
│ 'logs:DescribeLogStreams') │ │ ':*' log group ARN │
└──────────────────────────────┘ └──────────────────────────────┘
│
v
┌──────────────────────────────┐
│ Plain log group ARN missing. │
│ DescribeLogStreams is a │
│ group-level action. │
└──────────────────────────────┘
I reproduced this with cdk synth on 2.1.0 (the oldest tag I checked) and 2.275.0 (latest). I did not deploy. In both, the logs:DescribeLogStreams statement has one resource: the Fn::GetAtt ... Arn of the log group, with no plain log group ARN. grants.read() shows the same.
The :* suffix is intentional for stream actions, per the comment in the code:
// A LogGroup ARN out of CloudFormation already includes a ':*' at the end to include the log streams under the group.
// See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-loggroup.html#w2ab1c21c10c63c43c11
resourceArns: [this.logGroupArn],
resource: this,
});
}
Draft PR #39559 targets this. It changes grant() and a helper getter in log-group.ts. I did not run synth after that change, so I cannot say whether grants.read() is also fixed.
Passing both ARNs to every action would grant more than needed, since stream actions such as PutLogEvents would then apply to the whole log group. The fix should map each action to the right resource type.
changed the title [-](logs): LogGroup.grant() does not include the log group ARN[/-][+](logs): LogGroup.grant() and grantRead() do not include the log group ARN[/+]on Oct 30, 2026
Activity
pahud commentedon Oct 30, 2026
Hi @1992chenlu,
Issue at a Glance:
I reproduced this with
cdk synthon 2.1.0 (the oldest tag I checked) and 2.275.0 (latest). I did not deploy. In both, thelogs:DescribeLogStreamsstatement has one resource: theFn::GetAtt ... Arnof the log group, with no plain log group ARN.grants.read()shows the same.The
:*suffix is intentional for stream actions, per the comment in the code:aws-cdk/packages/aws-cdk-lib/aws-logs/lib/log-group.ts
Lines 270 to 279 in b7a057a
Draft PR #39559 targets this. It changes
grant()and a helper getter inlog-group.ts. I did not run synth after that change, so I cannot say whethergrants.read()is also fixed.Passing both ARNs to every action would grant more than needed, since stream actions such as
PutLogEventswould then apply to the whole log group. The fix should map each action to the right resource type.[-](logs): LogGroup.grant() does not include the log group ARN[/-][+](logs): LogGroup.grant() and grantRead() do not include the log group ARN[/+]