Skip to content

Commit 5d01a9d

Browse files
authored
Add currently gotcha to README
1 parent 3b34f04 commit 5d01a9d

File tree

1 file changed

+37
-2
lines changed

1 file changed

+37
-2
lines changed

README.md

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,43 @@ plugins:
8686
- serverless-step-functions
8787
```
8888

89-
Please note, that during normalization some characters will be changed to adhere to CloudFormation templates.
90-
You can get the real statemachine name using `{ "Fn::GetAtt": ["MyStateMachine", "Name"] }`.
89+
#### Current Gotcha
90+
Please keep this gotcha in mind when using this tips. To generate Logical ID for CloudFormation, the plugin transforms the specified name in serverless.yml based on the following scheme.
91+
92+
- Transform a leading character into uppercase
93+
- Transform `-` into Dash
94+
- Transform `_` into Underscore
95+
96+
If you want to use variables system in name statement, you can't put the variables as a prefix like this:`${self:service}-${opt:stage}-myStateMachine` since the variables are transformed within Output section, as a result, the reference will be broken.
97+
98+
The correct sample is here.
99+
100+
```yaml
101+
stepFunctions:
102+
stateMachines:
103+
etlStateMachine:
104+
name: myStateMachine-${self:service}-${opt:stage}
105+
events:
106+
- http:
107+
path: etl-trigger
108+
method: GET
109+
definition:
110+
Comment: "An example of the Amazon States Language using wait states"
111+
StartAt: read_queue
112+
States:
113+
read_queue:
114+
Type: Task
115+
Resource: arn:aws:lambda:${opt:region}:#{AWS::AccountId}:function:${self:service}-${opt:stage}-CheckQueue
116+
End: true
117+
118+
...
119+
120+
resources:
121+
Outputs:
122+
etlStateMachine:
123+
Value:
124+
Ref: MyStateMachineDash${self:service}Dash${opt:stage}
125+
```
91126

92127
## Events
93128
### API Gateway

0 commit comments

Comments
 (0)