Skip to content

added support for custom kms keys #644

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/deploy/stepFunctions/compileIamRole.js
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,13 @@ module.exports = {
});
}

if (stateMachineObj.encryptionConfig.KMSkeyId) {
iamPermissions.push({
action: 'kms:Decrypt,kms:Encrypt',
resource: stateMachineObj.encryptionConfig.KMSkeyId,
});
}

iamPermissions = consolidatePermissionsByAction(iamPermissions);
iamPermissions = consolidatePermissionsByResource(iamPermissions);
const iamStatements = getIamStatements(iamPermissions, stateMachineObj);
Expand Down
10 changes: 10 additions & 0 deletions lib/deploy/stepFunctions/compileStateMachines.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ module.exports = {
let DependsOn = [];
let LoggingConfiguration;
let TracingConfiguration;
let EncryptionConfiguration;
let Tags;
if (stateMachineObj.inheritGlobalTags === false) {
Tags = [];
Expand Down Expand Up @@ -219,6 +220,14 @@ module.exports = {
};
}

if (value.encryptionConfig) {
EncryptionConfiguration = {
KmsDataKeyReusePeriodSeconds: value.encryptionConfig.KMSkeyReusePeriod,
KmsKeyId: value.encryptionConfig.KMSkeyId,
Type: value.encryptionConfig.type,
}
}

const stateMachineOutputLogicalId = this
.getStateMachineOutputLogicalId(stateMachineName, stateMachineObj);

Expand All @@ -230,6 +239,7 @@ module.exports = {
StateMachineType: stateMachineObj.type,
LoggingConfiguration,
TracingConfiguration,
EncryptionConfiguration
},
DependsOn,
};
Expand Down
7 changes: 7 additions & 0 deletions lib/deploy/stepFunctions/compileStateMachines.schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ const tracingConfig = Joi.object().keys({
enabled: Joi.boolean().default(false),
});

const encryptionConfig = Joi.object().keys({
KMSkeyReusePeriod: Joi.number().default(900),
KMSkeyId: Joi.string().default(""),
type: Joi.string().default("AWS_OWNED_KEY"),
});

const iamRoleStatements = Joi.array().items(
Joi.object({
Effect: Joi.string().valid('Allow', 'Deny'),
Expand Down Expand Up @@ -82,6 +88,7 @@ const schema = Joi.object().keys({
retain,
loggingConfig,
tracingConfig,
encryptionConfig,
inheritGlobalTags,
iamRoleStatements,
}).oxor('role', 'iamRoleStatements');
Expand Down