diff --git a/lib/deploy/events/schedule/compileScheduledEvents.js b/lib/deploy/events/schedule/compileScheduledEvents.js index ee1db6fc..2adf70c3 100644 --- a/lib/deploy/events/schedule/compileScheduledEvents.js +++ b/lib/deploy/events/schedule/compileScheduledEvents.js @@ -156,6 +156,7 @@ module.exports = { "Target": { "Arn": { "Ref": "${stateMachineLogicalId}" }, "RoleArn": ${roleArn} + ${Input ? `,"Input": "${Input}"` : ''} }, "FlexibleTimeWindow": { "Mode": "OFF" diff --git a/lib/deploy/events/schedule/compileScheduledEvents.test.js b/lib/deploy/events/schedule/compileScheduledEvents.test.js index b5baefdd..bf3e7d80 100644 --- a/lib/deploy/events/schedule/compileScheduledEvents.test.js +++ b/lib/deploy/events/schedule/compileScheduledEvents.test.js @@ -512,6 +512,31 @@ describe('#httpValidate()', () => { expect(serverlessStepFunctions.serverless.service.provider.compiledCloudFormationTemplate.Resources.FirstStepFunctionsSchedulerSchedule1.Properties.ScheduleExpressionTimezone).to.equal('Asia/Mumbai'); }); + it('should define input when schedular and input are given', () => { + serverlessStepFunctions.serverless.service.stepFunctions = { + stateMachines: { + first: { + events: [ + { + schedule: { + method: 'scheduler', + rate: 'cron(1 3 * * ? *)', + enabled: false, + timezone: 'Asia/Mumbai', + input: { + key: 'value', + }, + }, + }, + ], + }, + }, + }; + serverlessStepFunctions.compileScheduledEvents(); + + expect(serverlessStepFunctions.serverless.service.provider.compiledCloudFormationTemplate.Resources.FirstStepFunctionsSchedulerSchedule1.Properties.Target.Input).to.equal('{"key":"value"}'); + }); + it('should accept timezone only if method is scheduler', () => { serverlessStepFunctions.serverless.service.stepFunctions = { stateMachines: {