@@ -92,39 +92,44 @@ export class SampleRegistrationWebPage extends Construct {
92
92
93
93
dynamicFile . node . addDependency ( staticFiles ) ;
94
94
95
- NagSuppressions . addResourceSuppressionsByPath (
96
- cdk . Stack . of ( this ) ,
97
- [
98
- `${ cdk . Stack . of ( this ) . stackName } /Custom::CDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C` ,
99
- ] ,
100
- [
101
- {
102
- id : 'AwsSolutions-IAM4' ,
103
- reason : 'Suppress usage of AWSLambdaBasicExecutionRole.' ,
104
- appliesTo : [
105
- 'Policy::arn:<AWS::Partition>:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole' ,
106
- ] ,
107
- } ,
108
- {
109
- id : 'AwsSolutions-IAM5' ,
110
- reason : 'Allow wildcard access for CDKBucketDeployment.' ,
111
- appliesTo : [
112
- 'Action::s3:GetObject*' ,
113
- 'Action::s3:GetBucket*' ,
114
- 'Action::s3:List*' ,
115
- `Resource::arn:<AWS::Partition>:s3:::cdk-${ cdk . DefaultStackSynthesizer . DEFAULT_QUALIFIER } -assets-<AWS::AccountId>-${ region } /*` ,
116
- 'Action::s3:DeleteObject*' ,
117
- 'Action::s3:Abort*' ,
118
- `Resource::<${ cdk . Stack . of ( this ) . getLogicalId ( websiteBucket . node . defaultChild as s3 . CfnBucket ) } .Arn>/*` ,
119
- ] ,
120
- } ,
121
- {
122
- id : 'AwsSolutions-L1' ,
123
- reason : 'NODEJS 18 is the version used cdk maanged custom resource.' ,
124
- } ,
125
- ] ,
126
- true
127
- ) ;
95
+ if (
96
+ cdk . Stack . of ( this ) . node . tryFindChild ( 'CDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C' )
97
+ ) {
98
+ const CDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C = cdk . Stack . of ( this ) . node . findChild (
99
+ 'CDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C'
100
+ ) ;
101
+ NagSuppressions . addResourceSuppressionsByPath (
102
+ cdk . Stack . of ( this ) ,
103
+ [ CDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C . node . path ] ,
104
+ [
105
+ {
106
+ id : 'AwsSolutions-IAM4' ,
107
+ reason : 'Suppress usage of AWSLambdaBasicExecutionRole.' ,
108
+ appliesTo : [
109
+ 'Policy::arn:<AWS::Partition>:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole' ,
110
+ ] ,
111
+ } ,
112
+ {
113
+ id : 'AwsSolutions-IAM5' ,
114
+ reason : 'Allow wildcard access for CDKBucketDeployment.' ,
115
+ appliesTo : [
116
+ 'Action::s3:GetObject*' ,
117
+ 'Action::s3:GetBucket*' ,
118
+ 'Action::s3:List*' ,
119
+ `Resource::arn:<AWS::Partition>:s3:::cdk-${ cdk . DefaultStackSynthesizer . DEFAULT_QUALIFIER } -assets-<AWS::AccountId>-${ region } /*` ,
120
+ 'Action::s3:DeleteObject*' ,
121
+ 'Action::s3:Abort*' ,
122
+ `Resource::<${ cdk . Stack . of ( this ) . getLogicalId ( websiteBucket . node . defaultChild as s3 . CfnBucket ) } .Arn>/*` ,
123
+ ] ,
124
+ } ,
125
+ {
126
+ id : 'AwsSolutions-L1' ,
127
+ reason : 'NODEJS 18 is the version used cdk maanged custom resource.' ,
128
+ } ,
129
+ ] ,
130
+ true
131
+ ) ;
132
+ }
128
133
129
134
const logBucket = new s3 . Bucket ( this , 'WebsiteS3BucketLog' , {
130
135
enforceSSL : true ,
0 commit comments