Skip to content
Merged
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
2 changes: 1 addition & 1 deletion lib/deploy/stepFunctions/compileIamRole.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ module.exports = {
const taskStates = getTaskStates(stateMachineObj.definition.States);
let iamPermissions = getIamPermissions.bind(this)(taskStates);

if (stateMachineObj.type === 'EXPRESS') {
if (stateMachineObj.loggingConfig) {
iamPermissions.push({
action: 'logs:CreateLogDelivery,logs:GetLogDelivery,logs:UpdateLogDelivery,logs:DeleteLogDelivery,logs:ListLogDeliveries,logs:PutResourcePolicy,logs:DescribeResourcePolicies,logs:DescribeLogGroups',
resource: '*',
Expand Down
3 changes: 1 addition & 2 deletions lib/deploy/stepFunctions/compileIamRole.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1786,12 +1786,11 @@ describe('#compileIamRole', () => {
expect(lambdaPermissions[0].Resource).to.deep.equal(lambdaArns);
});

it('should give CloudWatch Logs permissions for Express Workflow', () => {
it('should give CloudWatch Logs permissions', () => {
serverless.service.stepFunctions = {
stateMachines: {
myStateMachine1: {
id: 'StateMachine1',
type: 'EXPRESS',
loggingConfig: {
destinations: [
{
Expand Down
2 changes: 1 addition & 1 deletion lib/deploy/stepFunctions/compileStateMachines.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ module.exports = {
_.forEach(stateMachineTags, tag => Tags.push(tag));
}

if (value.type === 'EXPRESS' && value.loggingConfig) {
if (value.loggingConfig) {
const Destinations = (value.loggingConfig.destinations || [])
.map(arn => ({
CloudWatchLogsLogGroup: {
Expand Down
35 changes: 33 additions & 2 deletions lib/deploy/stepFunctions/compileStateMachines.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1307,12 +1307,44 @@ describe('#compileStateMachines', () => {
expect(definitionString).to.not.contain('#{AWS::AccountId}');
});

it('should compile logging configuration for Express Workflows', () => {
it('should compile Express Workflow', () => {
serverless.service.stepFunctions = {
stateMachines: {
myStateMachine1: {
name: 'stateMachineBeta1',
type: 'EXPRESS',
definition: {
StartAt: 'A',
States: {
A: {
Type: 'Task',
Resource: 'arn:aws:lambda:#{AWS::Region}:#{AWS::AccountId}:function:hello',
End: true,
},
},
},
},
},
};

serverlessStepFunctions.compileStateMachines();
const actual = serverlessStepFunctions
.serverless
.service
.provider
.compiledCloudFormationTemplate
.Resources
.StateMachineBeta1
.Properties;

expect(actual.StateMachineType).to.equal('EXPRESS');
});

it('should compile logging configuration', () => {
serverless.service.stepFunctions = {
stateMachines: {
myStateMachine1: {
name: 'stateMachineBeta1',
loggingConfig: {
destinations: [
{
Expand Down Expand Up @@ -1344,7 +1376,6 @@ describe('#compileStateMachines', () => {
.StateMachineBeta1
.Properties;

expect(actual.StateMachineType).to.equal('EXPRESS');
expect(actual).to.haveOwnProperty('LoggingConfiguration');
expect(actual.LoggingConfiguration.Level).to.equal('OFF'); // default value
expect(actual.LoggingConfiguration.IncludeExecutionData).to.equal(false); // default value
Expand Down