You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16-12Lines changed: 16 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -67,7 +67,7 @@ plugins:
67
67
68
68
## Setup
69
69
70
-
Specifies your statemachine definition using Amazon States Language in a `definition` statement in serverless.yml. You can use CloudFormation intrinsic functions such as `Ref` and `Fn::GetAtt` to reference Lambda functions, SNS topics, SQS queues and DynamoDB tables declared in the same `serverless.yml`.
70
+
Specifies your statemachine definition using Amazon States Language in a `definition` statement in serverless.yml. You can use CloudFormation intrinsic functions such as `Ref` and `Fn::GetAtt` to reference Lambda functions, SNS topics, SQS queues and DynamoDB tables declared in the same `serverless.yml`. Since `Ref` returns different things (ARN, ID, resource name, etc.) depending on the type of CloudFormation resource, please refer to [this page](https://theburningmonk.com/cloudformation-ref-and-getatt-cheatsheet/) to see whether you need to use `Ref` or `Fn::GetAtt`.
71
71
72
72
Alternatively, you can also provide the raw ARN, or SQS queue URL, or DynamoDB table name as a string. If you need to construct the ARN by hand, then we recommend to use the [serverless-pseudo-parameters](https://www.npmjs.com/package/serverless-pseudo-parameters) plugin together to make your life easier.
73
73
@@ -99,7 +99,7 @@ stepFunctions:
99
99
HelloWorld1:
100
100
Type: Task
101
101
Resource:
102
-
Fn::GetAtt: [HelloLambdaFunction, Arn]
102
+
Fn::GetAtt: [hello, Arn]
103
103
End: true
104
104
dependsOn: CustomIamRole
105
105
tags:
@@ -123,7 +123,7 @@ stepFunctions:
123
123
HelloWorld2:
124
124
Type: Task
125
125
Resource:
126
-
Fn::GetAtt: [HelloLambdaFunction, Arn]
126
+
Fn::GetAtt: [hello, Arn]
127
127
End: true
128
128
dependsOn:
129
129
- DynamoDBTable
@@ -140,6 +140,10 @@ plugins:
140
140
- serverless-pseudo-parameters
141
141
```
142
142
143
+
In the example above, notice that we used `Fn::GetAtt: [hello, Arn]` to get the ARN for the `hello` function defined earlier. This means you don't have to know how the `Serverless` framework converts these local names to CloudFormation logical IDs (e.g. `hello-world` becomes `HelloDashworldLambdaFunction`).
144
+
145
+
However, if you prefer to work with logical IDs, you can. You can also express the above `Fn::GetAtt` function as `Fn::GetAtt: [HelloLambdaFunction, Arn]`. If you're unfamiliar with the convention the `Serverless` framework uses, then the easiest thing to do is to first run `sls package` then look in the `.serverless` folder for the generated CloudFormation template. Here you can find the logical resource names for the functions you want to reference.
146
+
143
147
### Adding a custom name for a stateMachine
144
148
145
149
In case you need to interpolate a specific stage or service layer variable as the
0 commit comments