title: How to reference a dynamic lambda ARN in AWS Step Functions written in the Serverless Framework?
body: <p>EDIT: Just found this <a href="https://github.com/serverless-operations/serverless-step-functions/issues/209" rel="nofollow noreferrer">https://github.com/serverless-operations/serverless-step-functions/issues/209</a> Basically that example, but instead of hardcoding the ARN, I want to use a input variable, if that makes sense. </p>
  
  <p>Here's the context: </p>
  
  <p>Using Serverless' error destinations, an error payload is sent to SQS, which triggers a lambda that starts a state machine to perform a retry. </p>
  
  <p>For example, if Lambda A fails, the failure is sent to SQS -> Lambda B which triggers a state machine to retry Lambda A. </p>
  
  <p>I'm defining my state machine in Serverless.yml like so (This is what I've been trying so far):</p>
  
  <pre><code>stepFunctions:
    stateMachines:
      MyStateMachine:
        name: RetryLambdaMachine
        definition:
          Comment: Example to test retries
          StartAt: StepOne
          States:
            StepOne:
              Type: Task
              Resource: arn:aws:states:::lambda:invoke
              Parameters:
              - FunctionName.$: $$.lambdaArn 
              #### ^^ This is where I need Lambda A to be referenced ####
              Retry:
              - ErrorEquals: 
                - States.ALL
                MaxAttempts: 2
              Catch:
              - ErrorEquals: ["States.ALL"]
                Next: CatchAllFallback
              End: true
            CatchAllFallback:
              Type: Task
              Resource: 
                Fn::GetAtt: [lambda_c, Arn]
              End: true
  </code></pre>
  
  <p>Here is the error I get when I run <code>serverless deploy</code>:</p>
  
  <pre><code>Error: The CloudFormation template is invalid: [/Resources/RetryLambdasMachineRole/Type/Policies/0/PolicyDocument/Statement/0/Resource/0] 'null' values are not allowed in templates
  </code></pre>
  
  <p>How do I reference Lambda A as a variable? I know that the error attributes will contain Lambda A's ARN, but how do I pass that to the state machine for the retry step?</p>
  
  <p>Note: Lambda A is NOT defined within this Serverless.yml, it could come from anywhere. The ARN will be passed in as part of the error event coming from SQS, as stated above. </p>