Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow tagging of function #24

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: "[email protected]"


# if you'd like to include any shims
shims:
- ../shims/shim.js
Expand Down
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