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 5, 2020
1 parent c932778 commit 21dcb1b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
6 changes: 4 additions & 2 deletions 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 @@ -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 {
Expand Down
10 changes: 7 additions & 3 deletions utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ const createLambda = async ({
zipPath,
bucket,
role,
layer
layer,
tags
}) => {
const params = {
FunctionName: name,
Expand All @@ -88,6 +89,7 @@ const createLambda = async ({
Role: role.arn,
Runtime: runtime,
Timeout: timeout,
Tags: tags,
Environment: {
Variables: env
}
Expand Down Expand Up @@ -119,7 +121,8 @@ const updateLambdaConfig = async ({
env,
description,
role,
layer
layer,
tags
}) => {
const functionConfigParams = {
FunctionName: name,
Expand Down Expand Up @@ -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') {
Expand Down

0 comments on commit 21dcb1b

Please sign in to comment.