Invoke lambda arn for lambda in same file

I have one lambda that invokes another lambda in my serverless.yml:

provider:
    iamRoleStatements:
            - Effect: Allow
              Action:
                  - lambda:InvokeFunction
              Resource:
                  Fn::GetAtt:
                      - FunctionBLambdaFunction
                      - Arn

    functions:
        functionA:
            handler: ...
        functionB:
            handler: ...

I am trying to get the ARN for the function that needs invoked, but I am getting this error:

Error: The CloudFormation template is invalid: Circular dependency between resources

Is there a correct way to get the ARN for a lambda function like I do with Fn::GetAtt for anything defined in the resources section?

1 Like

I actually think this Github issue has the answer:

Resource:
              # NOTE you can't refer to the Logical ID of the Lambda, otherwise
              # there will be a circular reference in CloudFormation
              Fn::Join:
                  [':', [arn, aws, lambda, '', '', 'function', '${self:service}-${self:provider.stage}-functionB']]

Although it would be nice if this could be done in serverless.yml by referencing the function name.