Skip to content

Commit a6a5219

Browse files
feat(kms): key rotation period (#29928)
### Issue # (if applicable) Closes #29927. ### Reason for this change Cloudformation [supports for configuring period of automatic key rotation](https://docs.aws.amazon.com/ja_jp/AWSCloudFormation/latest/UserGuide/aws-resource-kms-key.html#cfn-kms-key-rotationperiodindays) but CDK does not. ### Description of changes Added `rotationPeriod` to `KeyProps`. ### Description of how you validated changes I've added both unit and integ tests. ### 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 a15dc93 commit a6a5219

File tree

12 files changed

+495
-1
lines changed

12 files changed

+495
-1
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-rotation.js.snapshot/TestStack.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,75 @@
1+
{
2+
"Resources": {
3+
"keyFEDD6EC0": {
4+
"Type": "AWS::KMS::Key",
5+
"Properties": {
6+
"EnableKeyRotation": true,
7+
"KeyPolicy": {
8+
"Statement": [
9+
{
10+
"Action": "kms:*",
11+
"Effect": "Allow",
12+
"Principal": {
13+
"AWS": {
14+
"Fn::Join": [
15+
"",
16+
[
17+
"arn:",
18+
{
19+
"Ref": "AWS::Partition"
20+
},
21+
":iam::",
22+
{
23+
"Ref": "AWS::AccountId"
24+
},
25+
":root"
26+
]
27+
]
28+
}
29+
},
30+
"Resource": "*"
31+
}
32+
],
33+
"Version": "2012-10-17"
34+
},
35+
"RotationPeriodInDays": 180
36+
},
37+
"UpdateReplacePolicy": "Retain",
38+
"DeletionPolicy": "Retain"
39+
}
40+
},
41+
"Parameters": {
42+
"BootstrapVersion": {
43+
"Type": "AWS::SSM::Parameter::Value<String>",
44+
"Default": "/cdk-bootstrap/hnb659fds/version",
45+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
46+
}
47+
},
48+
"Rules": {
49+
"CheckBootstrapVersion": {
50+
"Assertions": [
51+
{
52+
"Assert": {
53+
"Fn::Not": [
54+
{
55+
"Fn::Contains": [
56+
[
57+
"1",
58+
"2",
59+
"3",
60+
"4",
61+
"5"
62+
],
63+
{
64+
"Ref": "BootstrapVersion"
65+
}
66+
]
67+
}
68+
]
69+
},
70+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
71+
}
72+
]
73+
}
74+
}
75+
}

packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-rotation.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-kms/test/integ.key-rotation.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/aws-kms/test/integ.key-rotation.js.snapshot/kmskeyrotationDefaultTestDeployAssert801AD589.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-kms/test/integ.key-rotation.js.snapshot/kmskeyrotationDefaultTestDeployAssert801AD589.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-kms/test/integ.key-rotation.js.snapshot/manifest.json

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

0 commit comments

Comments
 (0)