@@ -34,6 +34,7 @@ stepFunctions:
34
34
- http:
35
35
path: gofunction
36
36
method: GET
37
+ name: myStateMachine
37
38
definition:
38
39
Comment: "A Hello World example of the Amazon States Language using an AWS Lambda Function"
39
40
StartAt: HelloWorld1
@@ -55,6 +56,31 @@ stepFunctions:
55
56
- yourTask
56
57
` ` `
57
58
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
+
58
84
# # Events
59
85
# ## API Gateway
60
86
To create HTTP endpoints as Event sources for your StepFunctions statemachine
@@ -135,45 +161,22 @@ functions:
135
161
hello :
136
162
handler : handler.hello
137
163
environment :
138
- statemachine_arn : ${self:resources.Outputs.HelloStepfunc .Value}
164
+ statemachine_arn : ${self:resources.Outputs.MyStateMachine .Value}
139
165
140
166
stepFunctions :
141
167
stateMachines :
142
168
hellostepfunc :
169
+ name : myStateMachine
143
170
definition :
144
171
<your definition>
145
172
146
173
resources :
147
174
Outputs :
148
- HelloStepfunc :
175
+ MyStateMachine :
149
176
Description : The ARN of the example state machine
150
177
Value :
151
- Ref : HellostepfuncStepFunctionsStateMachine
178
+ Ref : MyStateMachine
152
179
153
180
plugins :
154
181
- serverless-step-functions
155
182
` ` `
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