Skip to content

Commit 51b6994

Browse files
elmaimboNick Taitaaythapa
authored
Added kms:GenerateDataKey action to KMSEncryptPolicy policy (#3657)
Co-authored-by: Nick Tait <[email protected]> Co-authored-by: Aayush thapa <[email protected]>
1 parent 5892219 commit 51b6994

File tree

5 files changed

+110
-0
lines changed

5 files changed

+110
-0
lines changed

samtranslator/policy_templates_data/policy_templates.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,6 +1275,38 @@
12751275
}
12761276
}
12771277
},
1278+
"KMSEncryptPolicy_v2": {
1279+
"Definition": {
1280+
"Statement": [
1281+
{
1282+
"Action": [
1283+
"kms:Encrypt",
1284+
"kms:GenerateDataKey",
1285+
"kms:GenerateDataKeyWithoutPlaintext",
1286+
"kms:GenerateDataKeyPair",
1287+
"kms:GenerateDataKeyPairWithoutPlaintext"
1288+
],
1289+
"Effect": "Allow",
1290+
"Resource": {
1291+
"Fn::Sub": [
1292+
"arn:${AWS::Partition}:kms:${AWS::Region}:${AWS::AccountId}:key/${keyId}",
1293+
{
1294+
"keyId": {
1295+
"Ref": "KeyId"
1296+
}
1297+
}
1298+
]
1299+
}
1300+
}
1301+
]
1302+
},
1303+
"Description": "Gives permission to encrypt with KMS Key",
1304+
"Parameters": {
1305+
"KeyId": {
1306+
"Description": "ID of the KMS Key"
1307+
}
1308+
}
1309+
},
12781310
"KinesisCrudPolicy": {
12791311
"Definition": {
12801312
"Statement": [

tests/translator/input/all_policy_templates.yaml

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

188188
- StepFunctionsCallbackPolicy:
189189
StateMachineName: name
190+
191+
- KMSEncryptPolicy_v2:
192+
KeyId: keyId

tests/translator/output/all_policy_templates.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,6 +1726,31 @@
17261726
]
17271727
},
17281728
"PolicyName": "KitchenSinkFunctionRolePolicy63"
1729+
},
1730+
{
1731+
"PolicyDocument": {
1732+
"Statement": [
1733+
{
1734+
"Action": [
1735+
"kms:Encrypt",
1736+
"kms:GenerateDataKey",
1737+
"kms:GenerateDataKeyWithoutPlaintext",
1738+
"kms:GenerateDataKeyPair",
1739+
"kms:GenerateDataKeyPairWithoutPlaintext"
1740+
],
1741+
"Effect": "Allow",
1742+
"Resource": {
1743+
"Fn::Sub": [
1744+
"arn:${AWS::Partition}:kms:${AWS::Region}:${AWS::AccountId}:key/${keyId}",
1745+
{
1746+
"keyId": "keyId"
1747+
}
1748+
]
1749+
}
1750+
}
1751+
]
1752+
},
1753+
"PolicyName": "KitchenSinkFunctionRolePolicy64"
17291754
}
17301755
],
17311756
"Tags": [

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,6 +1726,31 @@
17261726
]
17271727
},
17281728
"PolicyName": "KitchenSinkFunctionRolePolicy63"
1729+
},
1730+
{
1731+
"PolicyDocument": {
1732+
"Statement": [
1733+
{
1734+
"Action": [
1735+
"kms:Encrypt",
1736+
"kms:GenerateDataKey",
1737+
"kms:GenerateDataKeyWithoutPlaintext",
1738+
"kms:GenerateDataKeyPair",
1739+
"kms:GenerateDataKeyPairWithoutPlaintext"
1740+
],
1741+
"Effect": "Allow",
1742+
"Resource": {
1743+
"Fn::Sub": [
1744+
"arn:${AWS::Partition}:kms:${AWS::Region}:${AWS::AccountId}:key/${keyId}",
1745+
{
1746+
"keyId": "keyId"
1747+
}
1748+
]
1749+
}
1750+
}
1751+
]
1752+
},
1753+
"PolicyName": "KitchenSinkFunctionRolePolicy64"
17291754
}
17301755
],
17311756
"Tags": [

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,6 +1726,31 @@
17261726
]
17271727
},
17281728
"PolicyName": "KitchenSinkFunctionRolePolicy63"
1729+
},
1730+
{
1731+
"PolicyDocument": {
1732+
"Statement": [
1733+
{
1734+
"Action": [
1735+
"kms:Encrypt",
1736+
"kms:GenerateDataKey",
1737+
"kms:GenerateDataKeyWithoutPlaintext",
1738+
"kms:GenerateDataKeyPair",
1739+
"kms:GenerateDataKeyPairWithoutPlaintext"
1740+
],
1741+
"Effect": "Allow",
1742+
"Resource": {
1743+
"Fn::Sub": [
1744+
"arn:${AWS::Partition}:kms:${AWS::Region}:${AWS::AccountId}:key/${keyId}",
1745+
{
1746+
"keyId": "keyId"
1747+
}
1748+
]
1749+
}
1750+
}
1751+
]
1752+
},
1753+
"PolicyName": "KitchenSinkFunctionRolePolicy64"
17291754
}
17301755
],
17311756
"Tags": [

0 commit comments

Comments
 (0)