I am creating StepFunctions which reference a Lambda function created in separate cloudformation stack. I exported the Lambda arn to CloudFormation export. And I would like to achieve to reference that Lambda function from the StepFunctions by importing exported value.
Here is my cloudformation snippet.
StepFunction:
Type: 'AWS::StepFunctions::StateMachine'
Properties:
RoleArn: !GetAtt IamRole.Arn
DefinitionString:
Fn::Sub:
- |-
{
"StartAt": "MessageGenerator",
"States": {
"MessageGenerator": {
"Comment": "generate queue message.",
"Type": "Task",
"Resource": "${LambdaMessageGenerator}",
"ResultPath": "$",
"OutputPath": "$",
"Next": "WaitSeconds"
},
...
}
}
- LambdaMessageGenerator:
Fn::ImportValue: some-export-name
I made this by following the answer bellow. Cloudformation - Unable to Import resource
However, aws cloudformation deploy command failed and I got the following error.
Invalid State Machine Definition: 'SCHEMA_VALIDATION_FAILED: Value is not a valid resource ARN at /States/MessageGenerator/Resource' (Service: AWSStepFunctions; Status Code: 400; Error Code: InvalidDefinition; Request ID: 01713d53-4605-11e9-9cf3-c15ff9ce09ae)
Could someone please help me?