@@ -34,6 +34,7 @@ stepFunctions:
3434 - http:
3535 path: gofunction
3636 method: GET
37+ name: myStateMachine
3738 definition:
3839 Comment: "A Hello World example of the Amazon States Language using an AWS Lambda Function"
3940 StartAt: HelloWorld1
@@ -55,6 +56,31 @@ stepFunctions:
5556 - yourTask
5657` ` `
5758
59+ # ## Adding a custom name for a stateMachine
60+ In case you need to interpolate a specific stage or service layer variable as the
61+ stateMachines name you can add a `name` property to your yaml.
62+
63+ ` ` ` yml
64+ service: messager
65+
66+ functions:
67+ sendMessage:
68+ handler: handler.sendMessage
69+
70+ stepFunctions:
71+ stateMachines:
72+ sendMessageFunc:
73+ name: sendMessageFunc-${self:custom.service}-${opt:stage}
74+ definition:
75+ <your definition>
76+
77+ plugins:
78+ - serverless-step-functions
79+ ` ` `
80+
81+ Please note, that during normalization some characters will be changed to adhere to CloudFormation templates.
82+ You can get the real statemachine name using `{ "Fn::GetAtt" : ["MyStateMachine", "Name"] }`.
83+
5884# # Events
5985# ## API Gateway
6086To create HTTP endpoints as Event sources for your StepFunctions statemachine
@@ -135,45 +161,22 @@ functions:
135161 hello :
136162 handler : handler.hello
137163 environment :
138- statemachine_arn : ${self:resources.Outputs.HelloStepfunc .Value}
164+ statemachine_arn : ${self:resources.Outputs.MyStateMachine .Value}
139165
140166stepFunctions :
141167 stateMachines :
142168 hellostepfunc :
169+ name : myStateMachine
143170 definition :
144171 <your definition>
145172
146173resources :
147174 Outputs :
148- HelloStepfunc :
175+ MyStateMachine :
149176 Description : The ARN of the example state machine
150177 Value :
151- Ref : HellostepfuncStepFunctionsStateMachine
178+ Ref : MyStateMachine
152179
153180plugins :
154181 - serverless-step-functions
155182` ` `
156-
157- ### Adding a custom name for a stateMachine
158- In case you need to interpolate a specific stage or service layer variable as the
159- stateMachines name you can add a ` Name` property to your yaml.
160-
161- ` ` ` yml
162- service: messager
163-
164- functions:
165- sendMessage:
166- handler: handler.sendMessage
167-
168- stepFunctions:
169- stateMachines:
170- sendMessageFunc:
171- Name: sendMessageFunc-${self:custom.service}-${opt:stage}
172- definition:
173- <your definition>
174-
175- plugins:
176- - serverless-step-functions
177- ` ` `
178-
179- Please note, that during normalization some characters will be changed to adhere to CloudFormation templates.
0 commit comments