@aws-solutions-constructs/resources 2.55.0 → 2.57.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/.jsii +58 -6
  2. package/lib/key-policy-updater.d.ts +1 -1
  3. package/lib/key-policy-updater.js +13 -18
  4. package/lib/template-writer.js +16 -37
  5. package/package.json +6 -6
  6. package/test/integ.key-policy-updater.d.ts +13 -0
  7. package/test/integ.key-policy-updater.js +65 -0
  8. package/test/integ.key-policy-updater.js.snapshot/asset.4a4b024f310aca2784b69bcb790e9ccaef785e9ad5d1b73624144f88c4465b4f/index.d.ts +30 -0
  9. package/test/integ.key-policy-updater.js.snapshot/asset.4a4b024f310aca2784b69bcb790e9ccaef785e9ad5d1b73624144f88c4465b4f/index.js +127 -0
  10. package/test/integ.key-policy-updater.js.snapshot/cdk.out +1 -0
  11. package/test/integ.key-policy-updater.js.snapshot/integ.json +12 -0
  12. package/test/integ.key-policy-updater.js.snapshot/key-policy-updater.assets.json +45 -0
  13. package/test/integ.key-policy-updater.js.snapshot/key-policy-updater.template.json +518 -0
  14. package/test/integ.key-policy-updater.js.snapshot/keypolicyupdaterIntegDefaultTestDeployAssert2855331B.assets.json +19 -0
  15. package/test/integ.key-policy-updater.js.snapshot/keypolicyupdaterIntegDefaultTestDeployAssert2855331B.template.json +36 -0
  16. package/test/integ.key-policy-updater.js.snapshot/manifest.json +185 -0
  17. package/test/integ.key-policy-updater.js.snapshot/tree.json +795 -0
  18. package/test/integ.template-writer-from-asset.js.snapshot/manifest.json +27 -9
  19. package/test/integ.template-writer-from-asset.js.snapshot/template-writer-from-asset.assets.json +5 -5
  20. package/test/integ.template-writer-from-asset.js.snapshot/template-writer-from-asset.template.json +65 -121
  21. package/test/integ.template-writer-from-asset.js.snapshot/tree.json +128 -192
  22. package/test/integ.template-writer-from-large-asset.js.snapshot/manifest.json +27 -9
  23. package/test/integ.template-writer-from-large-asset.js.snapshot/template-writer-from-large-asset.assets.json +5 -5
  24. package/test/integ.template-writer-from-large-asset.js.snapshot/template-writer-from-large-asset.template.json +65 -121
  25. package/test/integ.template-writer-from-large-asset.js.snapshot/tree.json +128 -192
@@ -0,0 +1,45 @@
1
+ {
2
+ "version": "36.0.0",
3
+ "files": {
4
+ "4a4b024f310aca2784b69bcb790e9ccaef785e9ad5d1b73624144f88c4465b4f": {
5
+ "source": {
6
+ "path": "asset.4a4b024f310aca2784b69bcb790e9ccaef785e9ad5d1b73624144f88c4465b4f",
7
+ "packaging": "zip"
8
+ },
9
+ "destinations": {
10
+ "current_account-current_region": {
11
+ "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
12
+ "objectKey": "4a4b024f310aca2784b69bcb790e9ccaef785e9ad5d1b73624144f88c4465b4f.zip",
13
+ "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
14
+ }
15
+ }
16
+ },
17
+ "3542be390685e0c8353d92ccb5796d343cd93ca946b6b0de798004206a199adc": {
18
+ "source": {
19
+ "path": "asset.3542be390685e0c8353d92ccb5796d343cd93ca946b6b0de798004206a199adc",
20
+ "packaging": "zip"
21
+ },
22
+ "destinations": {
23
+ "current_account-current_region": {
24
+ "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
25
+ "objectKey": "3542be390685e0c8353d92ccb5796d343cd93ca946b6b0de798004206a199adc.zip",
26
+ "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
27
+ }
28
+ }
29
+ },
30
+ "ce2a8018385dd7565e57e724cd0780b4d6d707af2e6640a2f590f7a7ea17a3a4": {
31
+ "source": {
32
+ "path": "key-policy-updater.template.json",
33
+ "packaging": "file"
34
+ },
35
+ "destinations": {
36
+ "current_account-current_region": {
37
+ "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
38
+ "objectKey": "ce2a8018385dd7565e57e724cd0780b4d6d707af2e6640a2f590f7a7ea17a3a4.json",
39
+ "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
40
+ }
41
+ }
42
+ }
43
+ },
44
+ "dockerImages": {}
45
+ }
@@ -0,0 +1,518 @@
1
+ {
2
+ "Description": "Integration Test for Key Policy Updater Resource",
3
+ "Resources": {
4
+ "testkey9B36F12B": {
5
+ "Type": "AWS::KMS::Key",
6
+ "Properties": {
7
+ "EnableKeyRotation": true,
8
+ "KeyPolicy": {
9
+ "Statement": [
10
+ {
11
+ "Action": "kms:*",
12
+ "Effect": "Allow",
13
+ "Principal": {
14
+ "AWS": {
15
+ "Fn::Join": [
16
+ "",
17
+ [
18
+ "arn:",
19
+ {
20
+ "Ref": "AWS::Partition"
21
+ },
22
+ ":iam::",
23
+ {
24
+ "Ref": "AWS::AccountId"
25
+ },
26
+ ":root"
27
+ ]
28
+ ]
29
+ }
30
+ },
31
+ "Resource": "*"
32
+ }
33
+ ],
34
+ "Version": "2012-10-17"
35
+ }
36
+ },
37
+ "UpdateReplacePolicy": "Delete",
38
+ "DeletionPolicy": "Delete"
39
+ },
40
+ "testbucketA976ABFD": {
41
+ "Type": "AWS::S3::Bucket",
42
+ "Properties": {
43
+ "BucketEncryption": {
44
+ "ServerSideEncryptionConfiguration": [
45
+ {
46
+ "ServerSideEncryptionByDefault": {
47
+ "SSEAlgorithm": "AES256"
48
+ }
49
+ }
50
+ ]
51
+ }
52
+ },
53
+ "UpdateReplacePolicy": "Delete",
54
+ "DeletionPolicy": "Delete",
55
+ "Metadata": {
56
+ "cfn_nag": {
57
+ "rules_to_suppress": [
58
+ {
59
+ "id": "W35",
60
+ "reason": "Test resource"
61
+ },
62
+ {
63
+ "id": "41",
64
+ "reason": "Test resource"
65
+ }
66
+ ]
67
+ }
68
+ }
69
+ },
70
+ "testbucketPolicy68299958": {
71
+ "Type": "AWS::S3::BucketPolicy",
72
+ "Properties": {
73
+ "Bucket": {
74
+ "Ref": "testbucketA976ABFD"
75
+ },
76
+ "PolicyDocument": {
77
+ "Statement": [
78
+ {
79
+ "Action": "s3:GetObject",
80
+ "Effect": "Allow",
81
+ "Principal": {
82
+ "CanonicalUser": {
83
+ "Fn::GetAtt": [
84
+ "testdistOrigin1S3Origin7E994241",
85
+ "S3CanonicalUserId"
86
+ ]
87
+ }
88
+ },
89
+ "Resource": {
90
+ "Fn::Join": [
91
+ "",
92
+ [
93
+ {
94
+ "Fn::GetAtt": [
95
+ "testbucketA976ABFD",
96
+ "Arn"
97
+ ]
98
+ },
99
+ "/*"
100
+ ]
101
+ ]
102
+ }
103
+ }
104
+ ],
105
+ "Version": "2012-10-17"
106
+ }
107
+ }
108
+ },
109
+ "testdistOrigin1S3Origin7E994241": {
110
+ "Type": "AWS::CloudFront::CloudFrontOriginAccessIdentity",
111
+ "Properties": {
112
+ "CloudFrontOriginAccessIdentityConfig": {
113
+ "Comment": "Identity for keypolicyupdatertestdistOrigin1D732FBD3"
114
+ }
115
+ }
116
+ },
117
+ "testdistE978BF1A": {
118
+ "Type": "AWS::CloudFront::Distribution",
119
+ "Properties": {
120
+ "DistributionConfig": {
121
+ "DefaultCacheBehavior": {
122
+ "CachePolicyId": "658327ea-f89d-4fab-a63d-7e88639e58f6",
123
+ "Compress": true,
124
+ "TargetOriginId": "keypolicyupdatertestdistOrigin1D732FBD3",
125
+ "ViewerProtocolPolicy": "allow-all"
126
+ },
127
+ "Enabled": true,
128
+ "HttpVersion": "http2",
129
+ "IPV6Enabled": true,
130
+ "Origins": [
131
+ {
132
+ "DomainName": {
133
+ "Fn::GetAtt": [
134
+ "testbucketA976ABFD",
135
+ "RegionalDomainName"
136
+ ]
137
+ },
138
+ "Id": "keypolicyupdatertestdistOrigin1D732FBD3",
139
+ "S3OriginConfig": {
140
+ "OriginAccessIdentity": {
141
+ "Fn::Join": [
142
+ "",
143
+ [
144
+ "origin-access-identity/cloudfront/",
145
+ {
146
+ "Ref": "testdistOrigin1S3Origin7E994241"
147
+ }
148
+ ]
149
+ ]
150
+ }
151
+ }
152
+ }
153
+ ]
154
+ }
155
+ },
156
+ "Metadata": {
157
+ "cfn_nag": {
158
+ "rules_to_suppress": [
159
+ {
160
+ "id": "W10",
161
+ "reason": "Test resource"
162
+ },
163
+ {
164
+ "id": "W70",
165
+ "reason": "Test resource"
166
+ }
167
+ ]
168
+ }
169
+ }
170
+ },
171
+ "LambdaFunctionServiceRole0C4CDE0B": {
172
+ "Type": "AWS::IAM::Role",
173
+ "Properties": {
174
+ "AssumeRolePolicyDocument": {
175
+ "Statement": [
176
+ {
177
+ "Action": "sts:AssumeRole",
178
+ "Effect": "Allow",
179
+ "Principal": {
180
+ "Service": "lambda.amazonaws.com"
181
+ }
182
+ }
183
+ ],
184
+ "Version": "2012-10-17"
185
+ },
186
+ "Policies": [
187
+ {
188
+ "PolicyDocument": {
189
+ "Statement": [
190
+ {
191
+ "Action": [
192
+ "logs:CreateLogGroup",
193
+ "logs:CreateLogStream",
194
+ "logs:PutLogEvents"
195
+ ],
196
+ "Effect": "Allow",
197
+ "Resource": {
198
+ "Fn::Join": [
199
+ "",
200
+ [
201
+ "arn:",
202
+ {
203
+ "Ref": "AWS::Partition"
204
+ },
205
+ ":logs:",
206
+ {
207
+ "Ref": "AWS::Region"
208
+ },
209
+ ":",
210
+ {
211
+ "Ref": "AWS::AccountId"
212
+ },
213
+ ":log-group:/aws/lambda/*"
214
+ ]
215
+ ]
216
+ }
217
+ }
218
+ ],
219
+ "Version": "2012-10-17"
220
+ },
221
+ "PolicyName": "LambdaFunctionServiceRolePolicy"
222
+ }
223
+ ]
224
+ }
225
+ },
226
+ "LambdaFunctionServiceRoleDefaultPolicy126C8897": {
227
+ "Type": "AWS::IAM::Policy",
228
+ "Properties": {
229
+ "PolicyDocument": {
230
+ "Statement": [
231
+ {
232
+ "Action": [
233
+ "xray:PutTelemetryRecords",
234
+ "xray:PutTraceSegments"
235
+ ],
236
+ "Effect": "Allow",
237
+ "Resource": "*"
238
+ }
239
+ ],
240
+ "Version": "2012-10-17"
241
+ },
242
+ "PolicyName": "LambdaFunctionServiceRoleDefaultPolicy126C8897",
243
+ "Roles": [
244
+ {
245
+ "Ref": "LambdaFunctionServiceRole0C4CDE0B"
246
+ }
247
+ ]
248
+ },
249
+ "Metadata": {
250
+ "cfn_nag": {
251
+ "rules_to_suppress": [
252
+ {
253
+ "id": "W12",
254
+ "reason": "Lambda needs the following minimum required permissions to send trace data to X-Ray and access ENIs in a VPC."
255
+ }
256
+ ]
257
+ }
258
+ }
259
+ },
260
+ "LambdaFunctionBF21E41F": {
261
+ "Type": "AWS::Lambda::Function",
262
+ "Properties": {
263
+ "Code": {
264
+ "S3Bucket": {
265
+ "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
266
+ },
267
+ "S3Key": "4a4b024f310aca2784b69bcb790e9ccaef785e9ad5d1b73624144f88c4465b4f.zip"
268
+ },
269
+ "Description": "Custom resource function that updates a provided key policy to allow CloudFront access.",
270
+ "Handler": "index.handler",
271
+ "Role": {
272
+ "Fn::GetAtt": [
273
+ "LambdaFunctionServiceRole0C4CDE0B",
274
+ "Arn"
275
+ ]
276
+ },
277
+ "Runtime": "nodejs18.x",
278
+ "TracingConfig": {
279
+ "Mode": "Active"
280
+ }
281
+ },
282
+ "DependsOn": [
283
+ "LambdaFunctionServiceRoleDefaultPolicy126C8897",
284
+ "LambdaFunctionServiceRole0C4CDE0B"
285
+ ],
286
+ "Metadata": {
287
+ "cfn_nag": {
288
+ "rules_to_suppress": [
289
+ {
290
+ "id": "W58",
291
+ "reason": "Lambda functions has the required permission to write CloudWatch Logs. It uses custom policy instead of arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole with tighter permissions."
292
+ },
293
+ {
294
+ "id": "W89",
295
+ "reason": "This is not a rule for the general case, just for specific use cases/industries"
296
+ },
297
+ {
298
+ "id": "W92",
299
+ "reason": "Impossible for us to define the correct concurrency for clients"
300
+ }
301
+ ]
302
+ }
303
+ }
304
+ },
305
+ "TestResourceCmkPolicy977FBAA4": {
306
+ "Type": "AWS::IAM::Policy",
307
+ "Properties": {
308
+ "PolicyDocument": {
309
+ "Statement": [
310
+ {
311
+ "Action": [
312
+ "kms:DescribeKey",
313
+ "kms:GetKeyPolicy",
314
+ "kms:PutKeyPolicy"
315
+ ],
316
+ "Effect": "Allow",
317
+ "Resource": {
318
+ "Fn::GetAtt": [
319
+ "testkey9B36F12B",
320
+ "Arn"
321
+ ]
322
+ }
323
+ }
324
+ ],
325
+ "Version": "2012-10-17"
326
+ },
327
+ "PolicyName": "TestResourceCmkPolicy977FBAA4",
328
+ "Roles": [
329
+ {
330
+ "Ref": "LambdaFunctionServiceRole0C4CDE0B"
331
+ }
332
+ ]
333
+ }
334
+ },
335
+ "KmsKeyPolicyUpdateProviderframeworkonEventServiceRoleD0164B97": {
336
+ "Type": "AWS::IAM::Role",
337
+ "Properties": {
338
+ "AssumeRolePolicyDocument": {
339
+ "Statement": [
340
+ {
341
+ "Action": "sts:AssumeRole",
342
+ "Effect": "Allow",
343
+ "Principal": {
344
+ "Service": "lambda.amazonaws.com"
345
+ }
346
+ }
347
+ ],
348
+ "Version": "2012-10-17"
349
+ },
350
+ "ManagedPolicyArns": [
351
+ {
352
+ "Fn::Join": [
353
+ "",
354
+ [
355
+ "arn:",
356
+ {
357
+ "Ref": "AWS::Partition"
358
+ },
359
+ ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
360
+ ]
361
+ ]
362
+ }
363
+ ]
364
+ }
365
+ },
366
+ "KmsKeyPolicyUpdateProviderframeworkonEventServiceRoleDefaultPolicyC8853973": {
367
+ "Type": "AWS::IAM::Policy",
368
+ "Properties": {
369
+ "PolicyDocument": {
370
+ "Statement": [
371
+ {
372
+ "Action": "lambda:InvokeFunction",
373
+ "Effect": "Allow",
374
+ "Resource": [
375
+ {
376
+ "Fn::GetAtt": [
377
+ "LambdaFunctionBF21E41F",
378
+ "Arn"
379
+ ]
380
+ },
381
+ {
382
+ "Fn::Join": [
383
+ "",
384
+ [
385
+ {
386
+ "Fn::GetAtt": [
387
+ "LambdaFunctionBF21E41F",
388
+ "Arn"
389
+ ]
390
+ },
391
+ ":*"
392
+ ]
393
+ ]
394
+ }
395
+ ]
396
+ }
397
+ ],
398
+ "Version": "2012-10-17"
399
+ },
400
+ "PolicyName": "KmsKeyPolicyUpdateProviderframeworkonEventServiceRoleDefaultPolicyC8853973",
401
+ "Roles": [
402
+ {
403
+ "Ref": "KmsKeyPolicyUpdateProviderframeworkonEventServiceRoleD0164B97"
404
+ }
405
+ ]
406
+ }
407
+ },
408
+ "KmsKeyPolicyUpdateProviderframeworkonEventEC76BE2C": {
409
+ "Type": "AWS::Lambda::Function",
410
+ "Properties": {
411
+ "Code": {
412
+ "S3Bucket": {
413
+ "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
414
+ },
415
+ "S3Key": "3542be390685e0c8353d92ccb5796d343cd93ca946b6b0de798004206a199adc.zip"
416
+ },
417
+ "Description": "AWS CDK resource provider framework - onEvent (key-policy-updater/KmsKeyPolicyUpdateProvider)",
418
+ "Environment": {
419
+ "Variables": {
420
+ "USER_ON_EVENT_FUNCTION_ARN": {
421
+ "Fn::GetAtt": [
422
+ "LambdaFunctionBF21E41F",
423
+ "Arn"
424
+ ]
425
+ }
426
+ }
427
+ },
428
+ "Handler": "framework.onEvent",
429
+ "Role": {
430
+ "Fn::GetAtt": [
431
+ "KmsKeyPolicyUpdateProviderframeworkonEventServiceRoleD0164B97",
432
+ "Arn"
433
+ ]
434
+ },
435
+ "Runtime": "nodejs18.x",
436
+ "Timeout": 900
437
+ },
438
+ "DependsOn": [
439
+ "KmsKeyPolicyUpdateProviderframeworkonEventServiceRoleDefaultPolicyC8853973",
440
+ "KmsKeyPolicyUpdateProviderframeworkonEventServiceRoleD0164B97"
441
+ ],
442
+ "Metadata": {
443
+ "cfn_nag": {
444
+ "rules_to_suppress": [
445
+ {
446
+ "id": "W58",
447
+ "reason": "The CDK-provided lambda function that backs their Custom Resource Provider framework has an IAM role with the arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole Managed Policy attached, which grants permission to write to CloudWatch Logs"
448
+ },
449
+ {
450
+ "id": "W89",
451
+ "reason": "The CDK-provided lambda function that backs their Custom Resource Provider framework does not access VPC resources"
452
+ },
453
+ {
454
+ "id": "W92",
455
+ "reason": "The CDK-provided lambda function that backs their Custom Resource Provider framework does not define ReservedConcurrentExecutions"
456
+ }
457
+ ]
458
+ }
459
+ }
460
+ },
461
+ "KmsKeyPolicyUpdater": {
462
+ "Type": "Custom::KmsKeyPolicyUpdater",
463
+ "Properties": {
464
+ "ServiceToken": {
465
+ "Fn::GetAtt": [
466
+ "KmsKeyPolicyUpdateProviderframeworkonEventEC76BE2C",
467
+ "Arn"
468
+ ]
469
+ },
470
+ "KmsKeyId": {
471
+ "Ref": "testkey9B36F12B"
472
+ },
473
+ "CloudFrontDistributionId": {
474
+ "Ref": "testdistE978BF1A"
475
+ },
476
+ "AccountId": {
477
+ "Ref": "AWS::AccountId"
478
+ }
479
+ },
480
+ "UpdateReplacePolicy": "Delete",
481
+ "DeletionPolicy": "Delete"
482
+ }
483
+ },
484
+ "Parameters": {
485
+ "BootstrapVersion": {
486
+ "Type": "AWS::SSM::Parameter::Value<String>",
487
+ "Default": "/cdk-bootstrap/hnb659fds/version",
488
+ "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
489
+ }
490
+ },
491
+ "Rules": {
492
+ "CheckBootstrapVersion": {
493
+ "Assertions": [
494
+ {
495
+ "Assert": {
496
+ "Fn::Not": [
497
+ {
498
+ "Fn::Contains": [
499
+ [
500
+ "1",
501
+ "2",
502
+ "3",
503
+ "4",
504
+ "5"
505
+ ],
506
+ {
507
+ "Ref": "BootstrapVersion"
508
+ }
509
+ ]
510
+ }
511
+ ]
512
+ },
513
+ "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
514
+ }
515
+ ]
516
+ }
517
+ }
518
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "version": "36.0.0",
3
+ "files": {
4
+ "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": {
5
+ "source": {
6
+ "path": "keypolicyupdaterIntegDefaultTestDeployAssert2855331B.template.json",
7
+ "packaging": "file"
8
+ },
9
+ "destinations": {
10
+ "current_account-current_region": {
11
+ "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
12
+ "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json",
13
+ "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
14
+ }
15
+ }
16
+ }
17
+ },
18
+ "dockerImages": {}
19
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "Parameters": {
3
+ "BootstrapVersion": {
4
+ "Type": "AWS::SSM::Parameter::Value<String>",
5
+ "Default": "/cdk-bootstrap/hnb659fds/version",
6
+ "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
7
+ }
8
+ },
9
+ "Rules": {
10
+ "CheckBootstrapVersion": {
11
+ "Assertions": [
12
+ {
13
+ "Assert": {
14
+ "Fn::Not": [
15
+ {
16
+ "Fn::Contains": [
17
+ [
18
+ "1",
19
+ "2",
20
+ "3",
21
+ "4",
22
+ "5"
23
+ ],
24
+ {
25
+ "Ref": "BootstrapVersion"
26
+ }
27
+ ]
28
+ }
29
+ ]
30
+ },
31
+ "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
32
+ }
33
+ ]
34
+ }
35
+ }
36
+ }