Skip to content

Commit 5f8e52e

Browse files
feat(codecommit): kmsKey for repository (#29988)
### Issue # (if applicable) Closes #. ### Reason for this change Cloudformation supports for using customer managed kms key to encrypt data in codecommit repository but CDK doesn't support it. ### Description of changes Add `kmsKey` property to `RepositoryProps`. ### Description of how you validated changes Add 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 fd3a5e3 commit 5f8e52e

12 files changed

+536
-0
lines changed

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

packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.repository-encryption.js.snapshot/RepositoryEncryptionTestDefaultTestDeployAssert819A2226.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-codecommit/test/integ.repository-encryption.js.snapshot/RepositoryEncryptionTestDefaultTestDeployAssert819A2226.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-codecommit/test/integ.repository-encryption.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-codecommit/test/integ.repository-encryption.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-codecommit/test/integ.repository-encryption.js.snapshot/manifest.json

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

0 commit comments

Comments
 (0)