diff --git a/README.md b/README.md index b489579..59cd1b0 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,11 @@ myFunction: TABLE_NAME: my-table region: us-east-1 + tags: + environment: "Production" + contact: "address@email.com" + + # if you'd like to include any shims shims: - ../shims/shim.js diff --git a/serverless.js b/serverless.js index 872ffec..bd7e9ca 100644 --- a/serverless.js +++ b/serverless.js @@ -28,7 +28,8 @@ const outputsList = [ 'role', 'layer', 'arn', - 'region' + 'region', + 'tags' ] const defaults = { @@ -43,6 +44,7 @@ const defaults = { env: {}, region: 'us-east-1', layers: [] + tags: {} } class AwsLambda extends Component { diff --git a/utils.js b/utils.js index 444a332..1fa5bce 100644 --- a/utils.js +++ b/utils.js @@ -1,4 +1,3 @@ -/* eslint-disable prettier/prettier */ const { tmpdir } = require('os') const path = require('path') const archiver = require('archiver') @@ -78,7 +77,8 @@ const createLambda = async ({ bucket, role, layer, // From autogenerated layer - layers // Manual layers + layers, // Manual layers + tags }) => { const params = { FunctionName: name, @@ -90,6 +90,7 @@ const createLambda = async ({ Role: role.arn, Runtime: runtime, Timeout: timeout, + Tags: tags, Environment: { Variables: env }, @@ -124,7 +125,8 @@ const updateLambdaConfig = async ({ description, role, layer, // From autogenerated layer - layers // Manual layers + layers, // Manual layers + tags }) => { const functionConfigParams = { FunctionName: name, @@ -186,7 +188,8 @@ const getLambda = async ({ lambda, name }) => { memory: res.MemorySize, hash: res.CodeSha256, env: res.Environment ? res.Environment.Variables : {}, - arn: res.FunctionArn + arn: res.FunctionArn, + tags: res.Tags } } catch (e) { if (e.code === 'ResourceNotFoundException') {