Skip to content

Commit

Permalink
Allow tagging of function
Browse files Browse the repository at this point in the history
  • Loading branch information
ration committed Feb 14, 2020
1 parent 448e723 commit 785cef4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion serverless.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ const outputsList = [
'role',
'layer',
'arn',
'region'
'region',
'tags'
]

const defaults = {
Expand All @@ -43,6 +44,7 @@ const defaults = {
env: {},
region: 'us-east-1',
layers: []
tags: {}
}

class AwsLambda extends Component {
Expand Down
11 changes: 7 additions & 4 deletions utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable prettier/prettier */
const { tmpdir } = require('os')
const path = require('path')
const archiver = require('archiver')
Expand Down Expand Up @@ -78,7 +77,8 @@ const createLambda = async ({
bucket,
role,
layer, // From autogenerated layer
layers // Manual layers
layers, // Manual layers
tags
}) => {
const params = {
FunctionName: name,
Expand All @@ -90,6 +90,7 @@ const createLambda = async ({
Role: role.arn,
Runtime: runtime,
Timeout: timeout,
Tags: tags,
Environment: {
Variables: env
},
Expand Down Expand Up @@ -124,7 +125,8 @@ const updateLambdaConfig = async ({
description,
role,
layer, // From autogenerated layer
layers // Manual layers
layers, // Manual layers
tags
}) => {
const functionConfigParams = {
FunctionName: name,
Expand Down Expand Up @@ -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') {
Expand Down

0 comments on commit 785cef4

Please sign in to comment.