-
Notifications
You must be signed in to change notification settings - Fork 9
/
serverless.yml
74 lines (67 loc) · 2.07 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
service:
name: odin
plugins:
- serverless-webpack
- serverless-cloudformation-resource-counter
- serverless-prune-versions
- serverless-plugin-thundra
provider:
name: aws
runtime: nodejs12.x
stage: ${self:custom.stage}
environment:
STAGE: ${self:custom.stage}
NODE_ENV: PRODUCTION
AWS_NODEJS_CONNECTION_REUSE_ENABLED: 1
LAMBDA_WRAPPER_LOG: true
thundra_apiKey: ${opt:thundra, env:THUNDRA_TOKEN}
DELETE_STACK_TOPIC: !Join
- ':'
- - arn:aws:sns
- !Ref AWS::Region
- !Ref AWS::AccountId
- delete-stack-${opt:stage, self:provider.stage}
iamRoleStatements:
- Effect: Allow
Resource: '*'
Action: '*'
custom:
odin: ${file(./odin.yml)}
stage: ${opt:stage, env:STAGE, 'local'}
# https://github.com/manwaring/serverless-prune-versions
prune:
automatic: true
number: 3
# https://github.com/drexler/serverless-cloudformation-resource-counter
warningThreshold: 100
# https://github.com/serverless-heaven/serverless-webpack
webpack:
includeModules: true
excludeFiles: src/**/*.test.[t|j]s
functions:
check-stacks:
handler: src/check-stacks/check.handler
events:
- schedule:
rate: ${self:custom.odin.schedule.daily.rate}
input: '${file(./odin-config-loader.js):daily}'
- schedule:
rate: ${self:custom.odin.schedule.hourly.rate}
input: '${file(./odin-config-loader.js):hourly}'
delete-stack:
handler: src/delete-stack/delete.handler
events:
- sns: delete-stack-${opt:stage, self:provider.stage}
resources:
Description: Automated service for destroying temporary stacks (retains production, qa, development, and automation stacks)
Outputs:
DeleteStackSNS:
Description: ARN of the ${opt:stage, self:provider.stage} stage SNS topic for stack deletion
Value:
Fn::Join:
- ':'
- - arn:aws:sns:us-east-1
- Ref: AWS::AccountId
- delete-stack-${opt:stage, self:provider.stage}
Export:
Name: odin-${opt:stage, self:provider.stage}-delete-stack-sns