Hi Guys,
I am trying to dynamically get the ARN of the stepMachine I created and so far so good.
The deployment is sucessfull but when I try to deploy to the other stage it complains the stepMachine exist already.
I do believe I need either:
- Creating 2 step machines per stage (tried to do that but didn’t work)
- Skip resource creation and use the created one
Here’s my serverless.yml for reference
org: melmacaluso
app: ms-pipedrive
service: ms-pipedrive
frameworkVersion: '>=1.0.0 <2.0.0'
provider:
name: aws
runtime: nodejs12.x
region: eu-west-2
stage: ${opt:stage, 'dev'}
environment:
stage: ${self:provider.stage}
stepmachine_arn: ${self:resources.Outputs.CheckDealAndUpdateIfOlderThan30MinutesMachine.Value}
iamRoleStatements:
- Effect: 'Allow'
Action:
- states:*
- secretsmanager:*
Resource: '*'
functions:
createDeal:
handler: index.createDeal
events:
- http:
path: create-deal
method: post
cors: true
checkDealsAndUpdateIfOlderThan30Minutes:
handler: index.checkDealsAndUpdateIfOlderThan30Minutes
stepFunctions:
stateMachines:
checkDealAndUpdateIfOlderThan30MinutesMachine:
name: checkDealAndUpdateIfOlderThan30MinutesMachine
definition:
StartAt: WaitSecondsTask
States:
WaitSecondsTask:
Type: Wait
SecondsPath: $.wait
Next: checkDealsAndUpdateIfOlderThan30MinutesTask
checkDealsAndUpdateIfOlderThan30MinutesTask:
Type: Task
Resource: 'arn:aws:lambda:#{AWS::Region}:#{AWS::AccountId}:function:${self:service}-${opt:stage}-checkDealsAndUpdateIfOlderThan30Minutes'
End: true
package:
individually: true
plugins:
- serverless-bundle
- serverless-step-functions
- serverless-pseudo-parameters
custom:
bundle:
sourcemaps: true
linting: false
resources:
Outputs:
CheckDealAndUpdateIfOlderThan30MinutesMachine:
Value:
Ref: CheckDealAndUpdateIfOlderThan30MinutesMachine