Skip to content

Commit c23f73f

Browse files
docs: updated docs about intrinsic functions
1 parent ef0c149 commit c23f73f

File tree

1 file changed

+26
-14
lines changed

1 file changed

+26
-14
lines changed

README.md

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@ plugins:
1515
```
1616
1717
## Setup
18-
Specifies your statemachine definition using Amazon States Language in a `definition` statement in serverless.yml.
19-
We recommend to use [serverless-pseudo-parameters](https://www.npmjs.com/package/serverless-pseudo-parameters) plugin together so that it makes it easy to set up `Resource` section under `definition`.
18+
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`.
19+
20+
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 it easier.
2021

2122
```yml
2223
functions:
23-
hellofunc:
24+
hello:
2425
handler: handler.hello
2526
2627
stepFunctions:
@@ -45,7 +46,8 @@ stepFunctions:
4546
States:
4647
HelloWorld1:
4748
Type: Task
48-
Resource: arn:aws:lambda:#{AWS::Region}:#{AWS::AccountId}:function:${self:service}-${opt:stage}-hello
49+
Resource:
50+
Ref: HelloLambdaFunction
4951
End: true
5052
dependsOn: CustomIamRole
5153
tags:
@@ -68,7 +70,8 @@ stepFunctions:
6870
States:
6971
HelloWorld2:
7072
Type: Task
71-
Resource: arn:aws:states:#{AWS::Region}:#{AWS::AccountId}:activity:myTask
73+
Resource:
74+
Ref: HelloLambdaFunction
7275
End: true
7376
dependsOn:
7477
- DynamoDBTable
@@ -515,7 +518,8 @@ functions:
515518
States:
516519
HelloWorld1:
517520
Type: Task
518-
Resource: arn:aws:lambda:#{AWS::Region}:#{AWS::AccountId}:function:${self:service}-${opt:stage}-hello
521+
Resource:
522+
Ref: HelloLambdaFunction
519523
End: true
520524
521525
@@ -824,7 +828,8 @@ stepFunctions:
824828
States:
825829
FirstState:
826830
Type: Task
827-
Resource: arn:aws:lambda:#{AWS::Region}:#{AWS::AccountId}:function:${self:service}-${opt:stage}-hello
831+
Resource:
832+
Ref: HelloLambdaFunction
828833
Next: wait_using_seconds
829834
wait_using_seconds:
830835
Type: Wait
@@ -844,7 +849,8 @@ stepFunctions:
844849
Next: FinalState
845850
FinalState:
846851
Type: Task
847-
Resource: arn:aws:lambda:#{AWS::Region}:#{AWS::AccountId}:function:${self:service}-${opt:stage}-hello
852+
Resource:
853+
Ref: HelloLambdaFunction
848854
End: true
849855
plugins:
850856
- serverless-step-functions
@@ -866,7 +872,8 @@ stepFunctions:
866872
States:
867873
HelloWorld:
868874
Type: Task
869-
Resource: arn:aws:lambda:#{AWS::Region}:#{AWS::AccountId}:function:${self:service}-${opt:stage}-hello
875+
Resource:
876+
Ref: HelloLambdaFunction
870877
Retry:
871878
- ErrorEquals:
872879
- HandledError
@@ -946,7 +953,8 @@ stepFunctions:
946953
States:
947954
HelloWorld:
948955
Type: Task
949-
Resource: arn:aws:lambda:#{AWS::Region}:#{AWS::AccountId}:function:${self:service}-${opt:stage}-hello
956+
Resource:
957+
Ref: HelloLambdaFunction
950958
Catch:
951959
- ErrorEquals: ["HandledError"]
952960
Next: CustomErrorFallback
@@ -994,7 +1002,8 @@ stepFunctions:
9941002
States:
9951003
FirstState:
9961004
Type: Task
997-
Resource: arn:aws:lambda:${opt:region}:${self:custom.accountId}:function:${self:service}-${opt:stage}-hello1
1005+
Resource:
1006+
Ref: Hello1LambdaFunction
9981007
Next: ChoiceState
9991008
ChoiceState:
10001009
Type: Choice
@@ -1008,18 +1017,21 @@ stepFunctions:
10081017
Default: DefaultState
10091018
FirstMatchState:
10101019
Type: Task
1011-
Resource: arn:aws:lambda:#{AWS::Region}:#{AWS::AccountId}:function:${self:service}-${opt:stage}-hello2
1020+
Resource:
1021+
Ref: Hello2LambdaFunction
10121022
Next: NextState
10131023
SecondMatchState:
10141024
Type: Task
1015-
Resource: arn:aws:lambda:#{AWS::Region}:#{AWS::AccountId}:function:${self:service}-${opt:stage}-hello3
1025+
Resource:
1026+
Ref: Hello3LambdaFunction
10161027
Next: NextState
10171028
DefaultState:
10181029
Type: Fail
10191030
Cause: "No Matches!"
10201031
NextState:
10211032
Type: Task
1022-
Resource: arn:aws:lambda:#{AWS::Region}:#{AWS::AccountId}:function:${self:service}-${opt:stage}-hello4
1033+
Resource:
1034+
Ref: Hello4LambdaFunction
10231035
End: true
10241036
plugins:
10251037
- serverless-step-functions

0 commit comments

Comments
 (0)