Skip to content

Commit 6ad48a3

Browse files
authored
2 parents 56ba2ab + 28e080a commit 6ad48a3

File tree

2,967 files changed

+79034
-70241
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,967 files changed

+79034
-70241
lines changed

.gitallowed

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ account: '422531588944'
2525
account: '924023996002'
2626
account: '919366029133' #cn-north-1
2727
account: '919830735681' #cn-northwest-1
28+
account: '909464085924' #ap-southeast-3
2829

2930
# The account IDs of password rotation applications of Serverless Application Repository
3031
# https://docs.aws.amazon.com/secretsmanager/latest/userguide/enable-rotation-rds.html

CHANGELOG.v2.alpha.md

+13
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
## [2.41.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.40.0-alpha.0...v2.41.0-alpha.0) (2022-09-07)
6+
7+
8+
### Features
9+
10+
* **batch:** add propagate tags prop in job definition ([#21904](https://github.com/aws/aws-cdk/issues/21904)) ([1bc4526](https://github.com/aws/aws-cdk/commit/1bc4526261c2fbdd6ce6c371ba1d9da2f79e07bd)), closes [#21740](https://github.com/aws/aws-cdk/issues/21740)
11+
12+
13+
### Bug Fixes
14+
15+
* **lambda-python:** bundling with poetry is broken ([#21945](https://github.com/aws/aws-cdk/issues/21945)) ([4b37157](https://github.com/aws/aws-cdk/commit/4b37157b47ab38124b62649649d0df9b701cb7fe)), closes [#21867](https://github.com/aws/aws-cdk/issues/21867)
16+
* **lambda-python:** poetry bundling fails on python3.7 ([#21950](https://github.com/aws/aws-cdk/issues/21950)) ([809e1b0](https://github.com/aws/aws-cdk/commit/809e1b0d5dc29be02f95ea4361b6f87f94325f3d))
17+
518
## [2.40.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.39.1-alpha.0...v2.40.0-alpha.0) (2022-08-31)
619

720

CHANGELOG.v2.md

+22
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,28 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
## [2.41.0](https://github.com/aws/aws-cdk/compare/v2.40.0...v2.41.0) (2022-09-07)
6+
7+
8+
### Features
9+
10+
* **assertions:** add function for verifying the number of matching resource properties ([#21707](https://github.com/aws/aws-cdk/issues/21707)) ([80cb527](https://github.com/aws/aws-cdk/commit/80cb527c01173a060064606b8fe286d5510f145e))
11+
* **custom-resource:** allow AwsCustomResource to be placed in vpc ([#21357](https://github.com/aws/aws-cdk/issues/21357)) ([62d7bf8](https://github.com/aws/aws-cdk/commit/62d7bf83b4bfe6358e86ecf1c332e51a3909bd8a))
12+
* **ec2:** allow private non-nat subnets ([#21699](https://github.com/aws/aws-cdk/issues/21699)) ([e1794e3](https://github.com/aws/aws-cdk/commit/e1794e346c2a04bf8f2e5f63138095a79f512cfe))
13+
* **ecs:** add `maxSwap` and `swappiness` properties to LinuxParameters ([#18703](https://github.com/aws/aws-cdk/issues/18703)) ([08eb1d6](https://github.com/aws/aws-cdk/commit/08eb1d66ae9caa6589c3ee66c4040a4e116adf52)), closes [#18460](https://github.com/aws/aws-cdk/issues/18460)
14+
* **lambda-event-sources:** add kafka consumerGroupId support ([#21791](https://github.com/aws/aws-cdk/issues/21791)) ([b36bc11](https://github.com/aws/aws-cdk/commit/b36bc1146d06c7b9decface9f4ed9edeca61aa56))
15+
* compress aws-cdk-lib tablet file ([#21854](https://github.com/aws/aws-cdk/issues/21854)) ([5a3db2d](https://github.com/aws/aws-cdk/commit/5a3db2d19dc5525bfef568f17fffa09657b6ef21))
16+
* **ecs:** add function for adding secrets to containers after instantiating them ([#21826](https://github.com/aws/aws-cdk/issues/21826)) ([572f781](https://github.com/aws/aws-cdk/commit/572f7815cc5447aac9413b374ebbfd92bfa610a6)), closes [#18959](https://github.com/aws/aws-cdk/issues/18959)
17+
18+
19+
### Bug Fixes
20+
21+
* **aws-cdk:** cdk bootstrap print JSON template when using --json option ([#21852](https://github.com/aws/aws-cdk/issues/21852)) ([7bc3d18](https://github.com/aws/aws-cdk/commit/7bc3d18ff742140a35238af0241b5dc4c2cf73ee)), closes [#21456](https://github.com/aws/aws-cdk/issues/21456) [#21456](https://github.com/aws/aws-cdk/issues/21456)
22+
* **core:** `--debug` doesn't record stack traces ([#21931](https://github.com/aws/aws-cdk/issues/21931)) ([9f2ea45](https://github.com/aws/aws-cdk/commit/9f2ea458609b29a91eb792165be6de596ce1aea9))
23+
* **events:** additional plaintext header are not set on eventbridge connection ([#21857](https://github.com/aws/aws-cdk/issues/21857)) ([f3f4814](https://github.com/aws/aws-cdk/commit/f3f4814b66ef2b0070fb6b25af9f6566bc1783a0))
24+
* **events-targets:** cannot set retry policy to 0 retry attempts ([#21900](https://github.com/aws/aws-cdk/issues/21900)) ([5549f16](https://github.com/aws/aws-cdk/commit/5549f1692270bce06a1d9cde952f9cd23a04204b)), closes [40aws-cdk/aws-events-targets/lib/util.ts#L54-L59](https://github.com/40aws-cdk/aws-events-targets/lib/util.ts/issues/L54-L59) [#21864](https://github.com/aws/aws-cdk/issues/21864)
25+
* **stepfunctions:** cfnSpec breaks definitionSubstitutions prop ([#21887](https://github.com/aws/aws-cdk/issues/21887)) ([3adf841](https://github.com/aws/aws-cdk/commit/3adf84188947eb2fde6171f70d0d9c2dcdb78563)), closes [#21653](https://github.com/aws/aws-cdk/issues/21653)
26+
527
## [2.40.0](https://github.com/aws/aws-cdk/compare/v2.39.1...v2.40.0) (2022-08-31)
628

729

package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
"devDependencies": {
1919
"@types/prettier": "2.6.0",
2020
"@yarnpkg/lockfile": "^1.1.0",
21-
"cdk-generate-synthetic-examples": "^0.1.16",
21+
"cdk-generate-synthetic-examples": "^0.1.17",
2222
"conventional-changelog-cli": "^2.2.2",
2323
"fs-extra": "^9.1.0",
2424
"graceful-fs": "^4.2.10",
2525
"jest-junit": "^13.2.0",
26-
"jsii-diff": "^1.66.0",
27-
"jsii-pacmak": "^1.66.0",
28-
"jsii-reflect": "^1.66.0",
29-
"jsii-rosetta": "^1.66.0",
26+
"jsii-diff": "^1.67.0",
27+
"jsii-pacmak": "^1.67.0",
28+
"jsii-reflect": "^1.67.0",
29+
"jsii-rosetta": "^1.67.0",
3030
"lerna": "^4.0.0",
3131
"patch-package": "^6.4.7",
3232
"semver": "^6.3.0",

packages/@aws-cdk/app-delivery/test/cicd.integ.snapshot/CICD.assets.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
2-
"version": "17.0.0",
2+
"version": "20.0.0",
33
"files": {
4-
"df2531bee6d1a5c15a480c358ebc18e306c13a2c9e3ee55d1116b6ef3c327f34": {
4+
"4844d07f1e19de1a0f6926b94b9bc19bf4e39bbb14b8511dee5d345f776182c7": {
55
"source": {
66
"path": "CICD.template.json",
77
"packaging": "file"
88
},
99
"destinations": {
1010
"current_account-current_region": {
1111
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
12-
"objectKey": "df2531bee6d1a5c15a480c358ebc18e306c13a2c9e3ee55d1116b6ef3c327f34.json",
12+
"objectKey": "4844d07f1e19de1a0f6926b94b9bc19bf4e39bbb14b8511dee5d345f776182c7.json",
1313
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
1414
}
1515
}

packages/@aws-cdk/app-delivery/test/cicd.integ.snapshot/CICD.template.json

+34
Original file line numberDiff line numberDiff line change
@@ -468,5 +468,39 @@
468468
]
469469
}
470470
}
471+
},
472+
"Parameters": {
473+
"BootstrapVersion": {
474+
"Type": "AWS::SSM::Parameter::Value<String>",
475+
"Default": "/cdk-bootstrap/hnb659fds/version",
476+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
477+
}
478+
},
479+
"Rules": {
480+
"CheckBootstrapVersion": {
481+
"Assertions": [
482+
{
483+
"Assert": {
484+
"Fn::Not": [
485+
{
486+
"Fn::Contains": [
487+
[
488+
"1",
489+
"2",
490+
"3",
491+
"4",
492+
"5"
493+
],
494+
{
495+
"Ref": "BootstrapVersion"
496+
}
497+
]
498+
}
499+
]
500+
},
501+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
502+
}
503+
]
504+
}
471505
}
472506
}
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"version":"17.0.0"}
1+
{"version":"20.0.0"}

packages/@aws-cdk/app-delivery/test/cicd.integ.snapshot/manifest.json

+38-2
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,43 @@
11
{
2-
"version": "17.0.0",
2+
"version": "20.0.0",
33
"artifacts": {
44
"Tree": {
55
"type": "cdk:tree",
66
"properties": {
77
"file": "tree.json"
88
}
99
},
10+
"CICD.assets": {
11+
"type": "cdk:asset-manifest",
12+
"properties": {
13+
"file": "CICD.assets.json",
14+
"requiresBootstrapStackVersion": 6,
15+
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version"
16+
}
17+
},
1018
"CICD": {
1119
"type": "aws:cloudformation:stack",
1220
"environment": "aws://unknown-account/unknown-region",
1321
"properties": {
1422
"templateFile": "CICD.template.json",
15-
"validateOnSynth": false
23+
"validateOnSynth": false,
24+
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
25+
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
26+
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/4844d07f1e19de1a0f6926b94b9bc19bf4e39bbb14b8511dee5d345f776182c7.json",
27+
"requiresBootstrapStackVersion": 6,
28+
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
29+
"additionalDependencies": [
30+
"CICD.assets"
31+
],
32+
"lookupRole": {
33+
"arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}",
34+
"requiresBootstrapStackVersion": 8,
35+
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version"
36+
}
1637
},
38+
"dependencies": [
39+
"CICD.assets"
40+
],
1741
"metadata": {
1842
"/CICD/ArtifactBucket/Resource": [
1943
{
@@ -74,6 +98,18 @@
7498
"type": "aws:cdk:logicalId",
7599
"data": "CodePipelineDeployChangeSetRoleDefaultPolicy289820BE"
76100
}
101+
],
102+
"/CICD/BootstrapVersion": [
103+
{
104+
"type": "aws:cdk:logicalId",
105+
"data": "BootstrapVersion"
106+
}
107+
],
108+
"/CICD/CheckBootstrapVersion": [
109+
{
110+
"type": "aws:cdk:logicalId",
111+
"data": "CheckBootstrapVersion"
112+
}
77113
]
78114
},
79115
"displayName": "CICD"

packages/@aws-cdk/app-delivery/test/cicd.integ.snapshot/tree.json

+12-12
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"path": "Tree",
1010
"constructInfo": {
1111
"fqn": "constructs.Construct",
12-
"version": "10.0.9"
12+
"version": "10.1.85"
1313
}
1414
},
1515
"CICD": {
@@ -288,13 +288,13 @@
288288
"path": "CICD/CodePipeline/Source/GitHub",
289289
"constructInfo": {
290290
"fqn": "constructs.Construct",
291-
"version": "10.0.9"
291+
"version": "10.1.85"
292292
}
293293
}
294294
},
295295
"constructInfo": {
296296
"fqn": "constructs.Construct",
297-
"version": "10.0.9"
297+
"version": "10.1.85"
298298
}
299299
},
300300
"Deploy": {
@@ -354,7 +354,7 @@
354354
"path": "CICD/CodePipeline/Deploy/Execute/CodePipelineActionRole/8389e75f-0810-4838-bf64-d6f85a95cf83",
355355
"constructInfo": {
356356
"fqn": "constructs.Construct",
357-
"version": "10.0.9"
357+
"version": "10.1.85"
358358
}
359359
},
360360
"DefaultPolicy": {
@@ -433,7 +433,7 @@
433433
},
434434
"constructInfo": {
435435
"fqn": "constructs.Construct",
436-
"version": "10.0.9"
436+
"version": "10.1.85"
437437
}
438438
},
439439
"ChangeSet": {
@@ -489,7 +489,7 @@
489489
"path": "CICD/CodePipeline/Deploy/ChangeSet/CodePipelineActionRole/8389e75f-0810-4838-bf64-d6f85a95cf83",
490490
"constructInfo": {
491491
"fqn": "constructs.Construct",
492-
"version": "10.0.9"
492+
"version": "10.1.85"
493493
}
494494
},
495495
"DefaultPolicy": {
@@ -708,13 +708,13 @@
708708
},
709709
"constructInfo": {
710710
"fqn": "constructs.Construct",
711-
"version": "10.0.9"
711+
"version": "10.1.85"
712712
}
713713
}
714714
},
715715
"constructInfo": {
716716
"fqn": "constructs.Construct",
717-
"version": "10.0.9"
717+
"version": "10.1.85"
718718
}
719719
}
720720
},
@@ -725,14 +725,14 @@
725725
}
726726
},
727727
"constructInfo": {
728-
"fqn": "@aws-cdk/core.Stack",
729-
"version": "0.0.0"
728+
"fqn": "constructs.Construct",
729+
"version": "10.1.85"
730730
}
731731
}
732732
},
733733
"constructInfo": {
734-
"fqn": "@aws-cdk/core.App",
735-
"version": "0.0.0"
734+
"fqn": "constructs.Construct",
735+
"version": "10.1.85"
736736
}
737737
}
738738
}

packages/@aws-cdk/assertions/README.md

+11
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,17 @@ in a template.
7676
template.resourceCountIs('Foo::Bar', 2);
7777
```
7878

79+
You can also count the number of resources of a specific type whose `Properties`
80+
section contains the specified properties:
81+
82+
```ts
83+
template.resourcePropertiesCountIs('Foo::Bar', {
84+
Foo: 'Bar',
85+
Baz: 5,
86+
Qux: [ 'Waldo', 'Fred' ],
87+
}, 1);
88+
```
89+
7990
## Resource Matching & Retrieval
8091

8192
Beyond resource counting, the module also allows asserting that a resource with

packages/@aws-cdk/assertions/lib/private/resources.ts

+24-2
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,12 @@ export function hasResource(template: Template, type: string, props: any): strin
3232
}
3333

3434
export function hasResourceProperties(template: Template, type: string, props: any): string | void {
35-
// amended needs to be a deep copy to avoid modifying the template.
36-
let amended = JSON.parse(JSON.stringify(template));
35+
let amended = template;
3736

3837
// special case to exclude AbsentMatch because adding an empty Properties object will affect its evaluation.
3938
if (!Matcher.isMatcher(props) || !(props instanceof AbsentMatch)) {
39+
// amended needs to be a deep copy to avoid modifying the template.
40+
amended = JSON.parse(JSON.stringify(template));
4041
amended = addEmptyProperties(amended);
4142
}
4243

@@ -52,6 +53,27 @@ export function countResources(template: Template, type: string): number {
5253
return Object.entries(types).length;
5354
}
5455

56+
export function countResourcesProperties(template: Template, type: string, props: any): number {
57+
let amended = template;
58+
59+
// special case to exclude AbsentMatch because adding an empty Properties object will affect its evaluation.
60+
if (!Matcher.isMatcher(props) || !(props instanceof AbsentMatch)) {
61+
// amended needs to be a deep copy to avoid modifying the template.
62+
amended = JSON.parse(JSON.stringify(template));
63+
amended = addEmptyProperties(amended);
64+
}
65+
66+
const section = amended.Resources ?? {};
67+
const result = matchSection(filterType(section, type), Match.objectLike({
68+
Properties: props,
69+
}));
70+
71+
if (result.match) {
72+
return Object.keys(result.matches).length;
73+
}
74+
return 0;
75+
}
76+
5577
function addEmptyProperties(template: Template): Template {
5678
let section = template.Resources ?? {};
5779

packages/@aws-cdk/assertions/lib/template.ts

+15-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { checkTemplateForCyclicDependencies } from './private/cyclic';
88
import { findMappings, hasMapping } from './private/mappings';
99
import { findOutputs, hasOutput } from './private/outputs';
1010
import { findParameters, hasParameter } from './private/parameters';
11-
import { countResources, findResources, hasResource, hasResourceProperties } from './private/resources';
11+
import { countResources, countResourcesProperties, findResources, hasResource, hasResourceProperties } from './private/resources';
1212
import { Template as TemplateType } from './private/template';
1313

1414
/**
@@ -71,6 +71,20 @@ export class Template {
7171
}
7272
}
7373

74+
/**
75+
* Assert that the given number of resources of the given type and properties exists in the
76+
* CloudFormation template.
77+
* @param type the resource type; ex: `AWS::S3::Bucket`
78+
* @param props the 'Properties' section of the resource as should be expected in the template.
79+
* @param count number of expected instances
80+
*/
81+
public resourcePropertiesCountIs(type: string, props: any, count: number): void {
82+
const counted = countResourcesProperties(this.template, type, props);
83+
if (counted !== count) {
84+
throw new Error(`Expected ${count} resources of type ${type} but found ${counted}`);
85+
}
86+
}
87+
7488
/**
7589
* Assert that a resource of the given type and properties exists in the
7690
* CloudFormation template.

0 commit comments

Comments
 (0)