Skip to content

Commit b6a15f3

Browse files
authored
feat(ec2): support PrefixList.fromLookup() (#33619)
### Issue # (if applicable) Closes #33606. Closes #15115. ### Reason for this change AWS-managed prefix lists are useful to control traffic VPC and AWS managed services. The name of the AWS-managed prefix list is documented but the id should be copy&paste by hand. ### Description of changes This PR implements `PrefixList.fromLookup()` to look up an existing managed prefix list by name. ``` ts ec2.PrefixList.fromLookup(this, 'CloudFrontOriginFacing', { prefixListName: 'com.amazonaws.global.cloudfront.origin-facing', }); ``` Uses the new CloudControl context provider: aws/aws-cdk-cli#138 and cdklabs/cloud-assembly-schema#124. ### Describe any new or updated permissions being added Nothing. ### Description of how you validated changes Added unit tests and an integ test. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent a9bae27 commit b6a15f3

13 files changed

+603
-6
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.prefix-list-lookup.js.snapshot/cdk.out

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.prefix-list-lookup.js.snapshot/integ.json

+13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.prefix-list-lookup.js.snapshot/manifest.json

+136
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.prefix-list-lookup.js.snapshot/prefixlist-from-lookup.assets.json

+20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"Outputs": {
3+
"PrefixListId": {
4+
"Value": "pl-xxxxxxxx"
5+
}
6+
},
7+
"Parameters": {
8+
"BootstrapVersion": {
9+
"Type": "AWS::SSM::Parameter::Value<String>",
10+
"Default": "/cdk-bootstrap/hnb659fds/version",
11+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
12+
}
13+
},
14+
"Rules": {
15+
"CheckBootstrapVersion": {
16+
"Assertions": [
17+
{
18+
"Assert": {
19+
"Fn::Not": [
20+
{
21+
"Fn::Contains": [
22+
[
23+
"1",
24+
"2",
25+
"3",
26+
"4",
27+
"5"
28+
],
29+
{
30+
"Ref": "BootstrapVersion"
31+
}
32+
]
33+
}
34+
]
35+
},
36+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
37+
}
38+
]
39+
}
40+
}
41+
}

packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.prefix-list-lookup.js.snapshot/prefixlistfromlookupintegDefaultTestDeployAssertE62179E7.assets.json

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.prefix-list-lookup.js.snapshot/prefixlistfromlookupintegDefaultTestDeployAssertE62179E7.template.json

+36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.prefix-list-lookup.js.snapshot/tree.json

+118
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)