Skip to content

Commit 2801355

Browse files
fix(iam): allow intrinsic functions in deletion policy (#28834)
> # Issue > > When using `CfnInclude` it was not possible to have an intrinsic function in the `DeletionPolicy`. It only allowed the DeletionPolicy to be explicitly defined. > # Solution > > Check if policy looks like an intrinsic. Check if it is an explicitly defined DeletionPolicy. Then Default to a case that checks if this is an intrinsic if it is return the policy after using parseValue. Else throw the same error it was previously. > # Important Design Decisions > > Unsure if any have been made please let me know if there are any I didn't think were Important Design Decisions. > > Remember to follow the [CONTRIBUTING GUIDE] and [DESIGN GUIDELINES] for any > code you submit. > > [CONTRIBUTING GUIDE]: https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md > [DESIGN GUIDELINES]: https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md Closes #28292 . ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 4a460a4 commit 2801355

File tree

14 files changed

+608
-3
lines changed

14 files changed

+608
-3
lines changed

packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.intrinsic-deletion-policy.js.snapshot/DeletionPolicyTestDefaultTestDeployAssert6189EF04.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/cloudformation-include/test/integ.intrinsic-deletion-policy.js.snapshot/DeletionPolicyTestDefaultTestDeployAssert6189EF04.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/cloudformation-include/test/integ.intrinsic-deletion-policy.js.snapshot/Stack.assets.json

+19
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,58 @@
1+
{
2+
"Conditions": {
3+
"AlwaysFalseCond": {
4+
"Fn::Equals": [
5+
{
6+
"Ref": "AWS::Region"
7+
},
8+
"completely-made-up-region"
9+
]
10+
}
11+
},
12+
"Resources": {
13+
"Bucket": {
14+
"Type": "AWS::S3::Bucket",
15+
"DeletionPolicy": {
16+
"Fn::If": [
17+
"AlwaysFalseCond",
18+
"Retain",
19+
"Delete"
20+
]
21+
}
22+
}
23+
},
24+
"Parameters": {
25+
"BootstrapVersion": {
26+
"Type": "AWS::SSM::Parameter::Value<String>",
27+
"Default": "/cdk-bootstrap/hnb659fds/version",
28+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
29+
}
30+
},
31+
"Rules": {
32+
"CheckBootstrapVersion": {
33+
"Assertions": [
34+
{
35+
"Assert": {
36+
"Fn::Not": [
37+
{
38+
"Fn::Contains": [
39+
[
40+
"1",
41+
"2",
42+
"3",
43+
"4",
44+
"5"
45+
],
46+
{
47+
"Ref": "BootstrapVersion"
48+
}
49+
]
50+
}
51+
]
52+
},
53+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
54+
}
55+
]
56+
}
57+
}
58+
}

packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.intrinsic-deletion-policy.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/cloudformation-include/test/integ.intrinsic-deletion-policy.js.snapshot/integ.json

+12
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/cloudformation-include/test/integ.intrinsic-deletion-policy.js.snapshot/manifest.json

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

0 commit comments

Comments
 (0)