I see that Serverless appends
LambdaFunction to the names of function resources when it creates the Cloudformation template. When I refer to these functions in the custom resources section of my
serverless.yml I have been doing the same:
functions: sendEmail: # I want to refer to this resource later ... resources: Resources: EmailerSchedule: Type: AWS::Events::Rule Properties: Targets: - Arn: Fn:Get:Att: - sendEmailLambdaFunction # I have to append `LambdaFunction` to the name specified under `functions` - Arn EmailerPermission: Type: AWS::Lambda::Permission Properties: FunctionName: Ref: sendEmailLambdaFunction # I have to append `LambdaFunction` to the name specified under `functions`
Is there a better way to do this, that doesn’t require implicit knowledge about how Serverless compiles the yaml file?
Update: I see in the documentation that this is a standard pattern, so presumably it will always be safe to hard-code the function name with
LambdaFunction appended. I would still be interested to know whether there is another way to get the same string, such as through a variable.