forked from antonbabenko/modules.tf-lambda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
76 lines (68 loc) · 1.96 KB
/
serverless.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
service: modules-tf
frameworkVersion: ">=1.26.0 <2.0.0"
provider:
name: aws
runtime: python3.7
stage: dev
region: eu-west-1
# profile: private-anton
tracing: true
timeout: 30
environment:
S3_BUCKET: "dl.modules.tf"
S3_DIR: ${self:custom.stage}
iamRoleStatements:
- Effect: "Allow"
Action:
- "s3:*" # "s3:PutObject" plus something more plus stage name
Resource:
- "arn:aws:s3:::${self:provider.environment.S3_BUCKET}/${self:provider.environment.S3_DIR}/*"
- "arn:aws:s3:::${self:provider.environment.S3_BUCKET}/${self:provider.environment.S3_DIR}/"
- Effect: "Allow" # xray permissions (required)
Action:
- "xray:PutTraceSegments"
- "xray:PutTelemetryRecords"
Resource:
- "*"
functions:
generate-cloudcraft:
name: ${self:service}-${self:custom.stage}-generate-cloudcraft
handler: handler.handler
description: Generate all from Cloudcraft URL (stage=${self:custom.stage})
memorySize: 1536
events:
- http:
method: get
path: /
cors: true
- http:
method: post
path: /
cors: true
plugins:
- serverless-domain-manager
- serverless-python-requirements
- serverless-plugin-tracing
custom:
stage: ${opt:stage, self:provider.stage}
domains:
prod: lambda.modules.tf
dev: dev-lambda.modules.tf
customDomain:
domainName: "${self:custom.domains.${self:custom.stage}}"
basePath: ""
stage: "${self:custom.stage}"
certificateName: "*.modules.tf"
createRoute53Record: true
pythonRequirements:
fileName: requirements-lambda.txt # requirements-lambda.txt does not have heavy libraries like matplotlib, python-lambda-local which are required for debug locally
dockerizePip: true
useDownloadCache: true
useStaticCache: true
package:
exclude:
- "input/**"
- "output/**"
- "test_fixtures/**"
- "node_modules/**"
- ".requirements-cache/**"