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 dd321d9..e41e1a4 100644 --- a/serverless.js +++ b/serverless.js @@ -28,7 +28,8 @@ const outputsList = [ 'role', 'layer', 'arn', - 'region' + 'region', + 'tags' ] const defaults = { @@ -41,7 +42,8 @@ const defaults = { handler: 'handler.hello', runtime: 'nodejs10.x', env: {}, - region: 'us-east-1' + region: 'us-east-1', + tags: {} } class AwsLambda extends Component { diff --git a/utils.js b/utils.js index 7e2aac2..e8711d6 100644 --- a/utils.js +++ b/utils.js @@ -76,7 +76,8 @@ const createLambda = async ({ zipPath, bucket, role, - layer + layer, + tags }) => { const params = { FunctionName: name, @@ -88,6 +89,7 @@ const createLambda = async ({ Role: role.arn, Runtime: runtime, Timeout: timeout, + Tags: tags, Environment: { Variables: env } @@ -119,7 +121,8 @@ const updateLambdaConfig = async ({ env, description, role, - layer + layer, + tags }) => { const functionConfigParams = { FunctionName: name, @@ -180,7 +183,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') {