Skip to content

Commit 21dcb1b

Browse files
committed
Allow tagging of function
Fixes serverless-components#22
1 parent c932778 commit 21dcb1b

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

serverless.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ const outputsList = [
2828
'role',
2929
'layer',
3030
'arn',
31-
'region'
31+
'region',
32+
'tags'
3233
]
3334

3435
const defaults = {
@@ -41,7 +42,8 @@ const defaults = {
4142
handler: 'handler.hello',
4243
runtime: 'nodejs10.x',
4344
env: {},
44-
region: 'us-east-1'
45+
region: 'us-east-1',
46+
tags: {}
4547
}
4648

4749
class AwsLambda extends Component {

utils.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ const createLambda = async ({
7676
zipPath,
7777
bucket,
7878
role,
79-
layer
79+
layer,
80+
tags
8081
}) => {
8182
const params = {
8283
FunctionName: name,
@@ -88,6 +89,7 @@ const createLambda = async ({
8889
Role: role.arn,
8990
Runtime: runtime,
9091
Timeout: timeout,
92+
Tags: tags,
9193
Environment: {
9294
Variables: env
9395
}
@@ -119,7 +121,8 @@ const updateLambdaConfig = async ({
119121
env,
120122
description,
121123
role,
122-
layer
124+
layer,
125+
tags
123126
}) => {
124127
const functionConfigParams = {
125128
FunctionName: name,
@@ -180,7 +183,8 @@ const getLambda = async ({ lambda, name }) => {
180183
memory: res.MemorySize,
181184
hash: res.CodeSha256,
182185
env: res.Environment ? res.Environment.Variables : {},
183-
arn: res.FunctionArn
186+
arn: res.FunctionArn,
187+
tags: res.Tags
184188
}
185189
} catch (e) {
186190
if (e.code === 'ResourceNotFoundException') {

0 commit comments

Comments
 (0)