Skip to content

Commit acf74c3

Browse files
committed
Move CDK-nag suppression to apply to ManagedPolicy construct instead of PolicyStatement
1 parent c51ecfd commit acf74c3

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

packages/cdk/resources/IamResources.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,6 @@ export class IamResources extends Construct {
6767
conditions: {"StringEquals": {"aws:ResourceAccount": props.account}}
6868
})
6969

70-
// Suppress CDK-nag warning for S3 wildcard resource
71-
NagSuppressions.addResourceSuppressions(s3AccessGetPolicy, [
72-
{
73-
id: "AwsSolutions-IAM5",
74-
reason: "Bedrock Knowledge Base requires wildcard access to read all objects in the S3 bucket",
75-
appliesTo: [`Resource::${props.kbDocsBucket.bucketArn}/*`]
76-
}
77-
])
78-
7970
// KMS permissions for S3 bucket encryption
8071
const kmsAccessPolicy = new PolicyStatement({
8172
actions: ["kms:Decrypt", "kms:DescribeKey"],
@@ -96,6 +87,15 @@ export class IamResources extends Construct {
9687
]
9788
})
9889

90+
// Suppress CDK-nag warning for S3 wildcard resource
91+
NagSuppressions.addResourceSuppressions(bedrockExecutionManagedPolicy, [
92+
{
93+
id: "AwsSolutions-IAM5",
94+
reason: "Bedrock Knowledge Base requires wildcard access to read all objects in the S3 bucket",
95+
appliesTo: [`Resource::${props.kbDocsBucket.bucketArn}/*`]
96+
}
97+
])
98+
9999
// Create Bedrock execution role with managed policy
100100
this.bedrockExecutionRole = new Role(this, "EpsAssistMeBedrockExecutionRole", {
101101
assumedBy: new ServicePrincipal("bedrock.amazonaws.com"),

0 commit comments

Comments
 (0)