Skip to content

Commit 6a1799b

Browse files
william.merzjlhood
authored andcommitted
Added KMSEncryptPolicy policy template and related test changes
1 parent 666235c commit 6a1799b

File tree

6 files changed

+89
-0
lines changed

6 files changed

+89
-0
lines changed

examples/2016-10-31/policy_templates/all_policy_templates.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ Resources:
8080
- KMSDecryptPolicy:
8181
KeyId: keyId
8282

83+
- KMSEncryptPolicy:
84+
KeyId: keyId
85+
8386
- SESBulkTemplatedCrudPolicy:
8487
IdentityName: name
8588

samtranslator/policy_templates_data/policy_templates.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,32 @@
798798
]
799799
}
800800
},
801+
"KMSEncryptPolicy": {
802+
"Description": "Gives permission to encrypt with KMS Key",
803+
"Parameters": {
804+
"KeyId": {
805+
"Description": "ID of the KMS Key"
806+
}
807+
},
808+
"Definition": {
809+
"Statement": [
810+
{
811+
"Action": "kms:Encrypt",
812+
"Effect": "Allow",
813+
"Resource": {
814+
"Fn::Sub": [
815+
"arn:${AWS::Partition}:kms:${AWS::Region}:${AWS::AccountId}:key/${keyId}",
816+
{
817+
"keyId": {
818+
"Ref": "KeyId"
819+
}
820+
}
821+
]
822+
}
823+
}
824+
]
825+
}
826+
},
801827
"PollyFullAccessPolicy": {
802828
"Description": "Gives full access permissions to Polly lexicon resources",
803829
"Parameters": {

tests/translator/input/all_policy_templates.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,6 @@ Resources:
151151

152152
- CodeCommitReadPolicy:
153153
RepositoryName: name
154+
155+
- KMSEncryptPolicy:
156+
KeyId: keyId

tests/translator/output/all_policy_templates.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1373,6 +1373,25 @@
13731373
}
13741374
]
13751375
}
1376+
},
1377+
{
1378+
"PolicyName": "KitchenSinkFunctionRolePolicy52",
1379+
"PolicyDocument": {
1380+
"Statement": [
1381+
{
1382+
"Action": "kms:Encrypt",
1383+
"Resource": {
1384+
"Fn::Sub": [
1385+
"arn:${AWS::Partition}:kms:${AWS::Region}:${AWS::AccountId}:key/${keyId}",
1386+
{
1387+
"keyId": "keyId"
1388+
}
1389+
]
1390+
},
1391+
"Effect": "Allow"
1392+
}
1393+
]
1394+
}
13761395
}
13771396
],
13781397
"AssumeRolePolicyDocument": {

tests/translator/output/aws-cn/all_policy_templates.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,6 +1372,25 @@
13721372
}
13731373
]
13741374
}
1375+
},
1376+
{
1377+
"PolicyName": "KitchenSinkFunctionRolePolicy52",
1378+
"PolicyDocument": {
1379+
"Statement": [
1380+
{
1381+
"Action": "kms:Encrypt",
1382+
"Resource": {
1383+
"Fn::Sub": [
1384+
"arn:${AWS::Partition}:kms:${AWS::Region}:${AWS::AccountId}:key/${keyId}",
1385+
{
1386+
"keyId": "keyId"
1387+
}
1388+
]
1389+
},
1390+
"Effect": "Allow"
1391+
}
1392+
]
1393+
}
13751394
}
13761395
],
13771396
"AssumeRolePolicyDocument": {

tests/translator/output/aws-us-gov/all_policy_templates.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1373,6 +1373,25 @@
13731373
}
13741374
]
13751375
}
1376+
},
1377+
{
1378+
"PolicyName": "KitchenSinkFunctionRolePolicy52",
1379+
"PolicyDocument": {
1380+
"Statement": [
1381+
{
1382+
"Action": "kms:Encrypt",
1383+
"Resource": {
1384+
"Fn::Sub": [
1385+
"arn:${AWS::Partition}:kms:${AWS::Region}:${AWS::AccountId}:key/${keyId}",
1386+
{
1387+
"keyId": "keyId"
1388+
}
1389+
]
1390+
},
1391+
"Effect": "Allow"
1392+
}
1393+
]
1394+
}
13761395
}
13771396
],
13781397
"AssumeRolePolicyDocument": {

0 commit comments

Comments
 (0)