Serverless framework plugin that will automatically generate AWS CloudFormation snippets to reference a functions name, ARN or logical ID value based on the internally generated Lambda logical ID. All 2.x versions support only Serverless 3.x. For Serverless 2.x please use the 1.x versions.
npm i -D serverless-plugin-function-value
service: test
plugins:
- serverless-plugin-function-value
provider:
name: aws
...
resources:
Resources:
LambdaFunctionExecutor:
DependsOn:
- ${fn.logicalid:test}
Type: Custom::LambdaFunctionExecutor
Properties:
ServiceToken: ${fn.arn:test}
Name: ${fn.name:test}
functions:
test:
...
During processing the ${fn.*}
related items will be resolved to either the
Fn::GetAtt
for ${fn.arn:*}
, Ref
for ${fn.name:*}
or simply the logical
ID for ${fn.logicalid:*}
. The custom resource above would look like the below
in the generated CloudFormation template.
"LambdaFunctionExecutor": {
"DependsOn": [
"TestLambdaFunction"
],
"Type": "Custom::LambdaFunctionExecutor",
"Properties": {
"ServiceToken": {
"Fn::GetAtt": [
"TestLambdaFunction",
"Arn"
]
},
"Name": {
"Ref": "TestLambdaFunction"
}
}
}
Development can be done on any machine that can install Node.js. Only the latest LTS version is tested against.
Install dependencies via npm
.
npm i
Execute linters via npm
.
# git, javascript, markdown and package.json
npm run lint
# git only
npm run lint:git
# javascript only
npm run lint:js
# markdown only
npm run lint:md
# package.json only
npm run lint:pkg
Execute tests via npm
.
# lint, unit tests and integration tests
npm test
# unit tests only
npm run test:unit
# integration tests only
npm run test:integration
Execute automatic fixers via npm
.
# javascript, markdown and package.json
npm run fix
# javascript only
npm run fix:js
# markdown only
npm run fix:md
# package.json only
npm run fix:pkg
Run a build via npm
.
npm run build