Skip to content

Commit b2dfac0

Browse files
authored
feat(ec2): Prefixlist Constructs (#25252)
I accidentally broke the branch while trying to resolve conflicts #24714 . I have addressed all of the comments made by @WinterYukky who reviewed my code. --- I created this Construct so that I can use AWS::EC2::PrefixList quickly. The differences from L1 are as follows: - If AddressFamily is not specified, ipv4 is used by default. - If maxEntries is not specified, the number of entries is automatically calculated from the entries array and set as maxEntries. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 99ddffc commit b2dfac0

13 files changed

+733
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"version":"31.0.0"}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"version": "31.0.0",
3+
"files": {
4+
"2cb0a44838e31f68717daa5de0b7b2149c2fedb3892bff48470b979550060afa": {
5+
"source": {
6+
"path": "integ-ec2-prefix-list-test.template.json",
7+
"packaging": "file"
8+
},
9+
"destinations": {
10+
"current_account-current_region": {
11+
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
12+
"objectKey": "2cb0a44838e31f68717daa5de0b7b2149c2fedb3892bff48470b979550060afa.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+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"Resources": {
3+
"PrefixList469FCC0B": {
4+
"Type": "AWS::EC2::PrefixList",
5+
"Properties": {
6+
"AddressFamily": "IPv4",
7+
"MaxEntries": 2,
8+
"PrefixListName": "integec2prefixlisttestPrefixList498BBB96",
9+
"Entries": [
10+
{
11+
"Cidr": "10.0.0.1/32"
12+
},
13+
{
14+
"Cidr": "10.0.0.2/32",
15+
"Description": "sample1"
16+
}
17+
]
18+
}
19+
}
20+
},
21+
"Parameters": {
22+
"BootstrapVersion": {
23+
"Type": "AWS::SSM::Parameter::Value<String>",
24+
"Default": "/cdk-bootstrap/hnb659fds/version",
25+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
26+
}
27+
},
28+
"Rules": {
29+
"CheckBootstrapVersion": {
30+
"Assertions": [
31+
{
32+
"Assert": {
33+
"Fn::Not": [
34+
{
35+
"Fn::Contains": [
36+
[
37+
"1",
38+
"2",
39+
"3",
40+
"4",
41+
"5"
42+
],
43+
{
44+
"Ref": "BootstrapVersion"
45+
}
46+
]
47+
}
48+
]
49+
},
50+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
51+
}
52+
]
53+
}
54+
}
55+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"version": "31.0.0",
3+
"testCases": {
4+
"integ-test/DefaultTest": {
5+
"stacks": [
6+
"integ-ec2-prefix-list-test"
7+
],
8+
"assertionStack": "integ-test/DefaultTest/DeployAssert",
9+
"assertionStackName": "integtestDefaultTestDeployAssert24D5C536"
10+
}
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"version": "31.0.0",
3+
"files": {
4+
"21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": {
5+
"source": {
6+
"path": "integtestDefaultTestDeployAssert24D5C536.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+
}
Original file line numberDiff line numberDiff line change
@@ -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+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
{
2+
"version": "31.0.0",
3+
"artifacts": {
4+
"integ-ec2-prefix-list-test.assets": {
5+
"type": "cdk:asset-manifest",
6+
"properties": {
7+
"file": "integ-ec2-prefix-list-test.assets.json",
8+
"requiresBootstrapStackVersion": 6,
9+
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version"
10+
}
11+
},
12+
"integ-ec2-prefix-list-test": {
13+
"type": "aws:cloudformation:stack",
14+
"environment": "aws://unknown-account/unknown-region",
15+
"properties": {
16+
"templateFile": "integ-ec2-prefix-list-test.template.json",
17+
"validateOnSynth": false,
18+
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
19+
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
20+
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/2cb0a44838e31f68717daa5de0b7b2149c2fedb3892bff48470b979550060afa.json",
21+
"requiresBootstrapStackVersion": 6,
22+
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
23+
"additionalDependencies": [
24+
"integ-ec2-prefix-list-test.assets"
25+
],
26+
"lookupRole": {
27+
"arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}",
28+
"requiresBootstrapStackVersion": 8,
29+
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version"
30+
}
31+
},
32+
"dependencies": [
33+
"integ-ec2-prefix-list-test.assets"
34+
],
35+
"metadata": {
36+
"/integ-ec2-prefix-list-test/PrefixList/Resource": [
37+
{
38+
"type": "aws:cdk:logicalId",
39+
"data": "PrefixList469FCC0B"
40+
}
41+
],
42+
"/integ-ec2-prefix-list-test/BootstrapVersion": [
43+
{
44+
"type": "aws:cdk:logicalId",
45+
"data": "BootstrapVersion"
46+
}
47+
],
48+
"/integ-ec2-prefix-list-test/CheckBootstrapVersion": [
49+
{
50+
"type": "aws:cdk:logicalId",
51+
"data": "CheckBootstrapVersion"
52+
}
53+
]
54+
},
55+
"displayName": "integ-ec2-prefix-list-test"
56+
},
57+
"integtestDefaultTestDeployAssert24D5C536.assets": {
58+
"type": "cdk:asset-manifest",
59+
"properties": {
60+
"file": "integtestDefaultTestDeployAssert24D5C536.assets.json",
61+
"requiresBootstrapStackVersion": 6,
62+
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version"
63+
}
64+
},
65+
"integtestDefaultTestDeployAssert24D5C536": {
66+
"type": "aws:cloudformation:stack",
67+
"environment": "aws://unknown-account/unknown-region",
68+
"properties": {
69+
"templateFile": "integtestDefaultTestDeployAssert24D5C536.template.json",
70+
"validateOnSynth": false,
71+
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
72+
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
73+
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json",
74+
"requiresBootstrapStackVersion": 6,
75+
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
76+
"additionalDependencies": [
77+
"integtestDefaultTestDeployAssert24D5C536.assets"
78+
],
79+
"lookupRole": {
80+
"arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}",
81+
"requiresBootstrapStackVersion": 8,
82+
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version"
83+
}
84+
},
85+
"dependencies": [
86+
"integtestDefaultTestDeployAssert24D5C536.assets"
87+
],
88+
"metadata": {
89+
"/integ-test/DefaultTest/DeployAssert/BootstrapVersion": [
90+
{
91+
"type": "aws:cdk:logicalId",
92+
"data": "BootstrapVersion"
93+
}
94+
],
95+
"/integ-test/DefaultTest/DeployAssert/CheckBootstrapVersion": [
96+
{
97+
"type": "aws:cdk:logicalId",
98+
"data": "CheckBootstrapVersion"
99+
}
100+
]
101+
},
102+
"displayName": "integ-test/DefaultTest/DeployAssert"
103+
},
104+
"Tree": {
105+
"type": "cdk:tree",
106+
"properties": {
107+
"file": "tree.json"
108+
}
109+
}
110+
}
111+
}

0 commit comments

Comments
 (0)