Skip to content
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
43 changes: 43 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Following variables must be specified in GitLab CI group variables set:
# * AWS_ACCOUNTID
# * SERVERLESS_DEPLOYMENT_BUCKET
# * AWS_DEFAULT_REGION
# * CI_IMAGE
# * VAULT_ADDR

# following variables must be specified explicitly for the gitlab project and must not be shared between multiple projects
# * API_GATEWAY_ID
# * API_GATEWAY_RESOURCE_ID

image: ${CI_IMAGE}

variables:
CONTEXT: <context>
SERVICE: <service>

stages:
- staging
- production

.serverless:
only:
- master
except:
- tags
allow_failure: false
script:
- npm install serverless-plugin-lambda-dead-letter --loglevel=error
- vaultenv serverless deploy --stage ${ENVIRONMENT} --verbose

serverless:staging:
stage: staging
extends: .serverless
variables:
ENVIRONMENT: staging

serverless:production:
stage: production
extends: .serverless
when: manual
variables:
ENVIRONMENT: production
21 changes: 21 additions & 0 deletions resources/lambda.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import json


def handler(event, context):
body = {
"message": "Go Serverless v1.0! Your function executed successfully!",
"input": event,
}

response = {"statusCode": 200, "body": json.dumps(body)}

return response

# Use this code if you don't USE the http event with the LAMBDA-PROXY
# integration
"""
return {
"message": "Go Serverless v1.0! Your function executed successfully!",
"event": event
}
"""
17 changes: 17 additions & 0 deletions vaultenv.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
auth:
method: kubernetes
data:
role: gitlab

# arguments specified here can be specified when running vaultenv like so:
# > vaultenv --arg environment=production --arg context=snakegame env
args:
- name: ENVIRONMENT
- name: CONTEXT

secrets:
# creates AWS credentials that are revoked after 15 minutes
- write: aws/sts/${CONTEXT}-${ENVIRONMENT}-infrastructure
type: aws
data:
ttl: 15m