Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added kms:GenerateDataKey action to KMSEncryptPolicy policy #3657

Merged
merged 9 commits into from
Nov 4, 2024
32 changes: 32 additions & 0 deletions samtranslator/policy_templates_data/policy_templates.json
Original file line number Diff line number Diff line change
Expand Up @@ -1275,6 +1275,38 @@
}
}
},
"KMSEncryptPolicy_v2": {
"Definition": {
"Statement": [
{
"Action": [
aaythapa marked this conversation as resolved.
Show resolved Hide resolved
"kms:Encrypt",
"kms:GenerateDataKey",
"kms:GenerateDataKeyWithoutPlaintext",
"kms:GenerateDataKeyPair",
"kms:GenerateDataKeyPairWithoutPlaintext"
],
"Effect": "Allow",
"Resource": {
"Fn::Sub": [
"arn:${AWS::Partition}:kms:${AWS::Region}:${AWS::AccountId}:key/${keyId}",
{
"keyId": {
"Ref": "KeyId"
}
}
]
}
}
]
},
"Description": "Gives permission to encrypt with KMS Key",
"Parameters": {
"KeyId": {
"Description": "ID of the KMS Key"
}
}
},
"KinesisCrudPolicy": {
"Definition": {
"Statement": [
Expand Down
3 changes: 3 additions & 0 deletions tests/translator/input/all_policy_templates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,6 @@ Resources:

- StepFunctionsCallbackPolicy:
StateMachineName: name

- KMSEncryptPolicy_v2:
KeyId: keyId
25 changes: 25 additions & 0 deletions tests/translator/output/all_policy_templates.json
Original file line number Diff line number Diff line change
Expand Up @@ -1726,6 +1726,31 @@
]
},
"PolicyName": "KitchenSinkFunctionRolePolicy63"
},
{
"PolicyDocument": {
"Statement": [
{
"Action": [
"kms:Encrypt",
"kms:GenerateDataKey",
"kms:GenerateDataKeyWithoutPlaintext",
"kms:GenerateDataKeyPair",
"kms:GenerateDataKeyPairWithoutPlaintext"
],
"Effect": "Allow",
"Resource": {
"Fn::Sub": [
"arn:${AWS::Partition}:kms:${AWS::Region}:${AWS::AccountId}:key/${keyId}",
{
"keyId": "keyId"
}
]
}
}
]
},
"PolicyName": "KitchenSinkFunctionRolePolicy64"
}
],
"Tags": [
Expand Down
25 changes: 25 additions & 0 deletions tests/translator/output/aws-cn/all_policy_templates.json
Original file line number Diff line number Diff line change
Expand Up @@ -1726,6 +1726,31 @@
]
},
"PolicyName": "KitchenSinkFunctionRolePolicy63"
},
{
"PolicyDocument": {
"Statement": [
{
"Action": [
"kms:Encrypt",
"kms:GenerateDataKey",
"kms:GenerateDataKeyWithoutPlaintext",
"kms:GenerateDataKeyPair",
"kms:GenerateDataKeyPairWithoutPlaintext"
],
"Effect": "Allow",
"Resource": {
"Fn::Sub": [
"arn:${AWS::Partition}:kms:${AWS::Region}:${AWS::AccountId}:key/${keyId}",
{
"keyId": "keyId"
}
]
}
}
]
},
"PolicyName": "KitchenSinkFunctionRolePolicy64"
}
],
"Tags": [
Expand Down
25 changes: 25 additions & 0 deletions tests/translator/output/aws-us-gov/all_policy_templates.json
Original file line number Diff line number Diff line change
Expand Up @@ -1726,6 +1726,31 @@
]
},
"PolicyName": "KitchenSinkFunctionRolePolicy63"
},
{
"PolicyDocument": {
"Statement": [
{
"Action": [
"kms:Encrypt",
"kms:GenerateDataKey",
"kms:GenerateDataKeyWithoutPlaintext",
"kms:GenerateDataKeyPair",
"kms:GenerateDataKeyPairWithoutPlaintext"
],
"Effect": "Allow",
"Resource": {
"Fn::Sub": [
"arn:${AWS::Partition}:kms:${AWS::Region}:${AWS::AccountId}:key/${keyId}",
{
"keyId": "keyId"
}
]
}
}
]
},
"PolicyName": "KitchenSinkFunctionRolePolicy64"
}
],
"Tags": [
Expand Down