Referencing Lambda version in other variables



I noticed Serverless will auto-increment the Lambda version, which is great for safely deploying updates. However, I’m wondering how to reference that version number in serverless.yml. For example, in a stepFunctions definition:

              - StartAt: Transcode
                    Type: Task
                    Resource: arn:aws:lambda:#{AWS::Region}:#{AWS::AccountId}:function:${self:service}-${self:custom.stage}-transcode
                    End: true

I’d instead like the source to end with :${currentVersion} for example. Is this possible? Or can I somehow just use the fully qualified Lambda ARN?


A few thoughts:

In AWS, there’s a variable for Lambda version called $LATEST:

but I wonder if you really want to do latest version - usually you’ll want to work with stage and/or version aliases.


No, I definitely don’t want the $LATEST version. I’m looking to use the version of the function that was just auto-created by Serverless. I don’t think it’s possible, which is a bummer. It means I’ll have to have two separate YAML files/CloudFormation stacks, and one will use the outputs to get the Lambda ARNs (with version numbers).