forked from manwaring-automation/odin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
86 lines (78 loc) · 2.29 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
77
78
79
80
81
82
83
84
85
86
service: odin
plugins:
- serverless-webpack
- serverless-plugin-thundra
- serverless-cloudformation-resource-counter
- serverless-prune-versions
provider:
name: aws
runtime: nodejs12.x
stage: ${self:custom.stage}
region: us-east-2
environment:
STAGE: ${self:custom.stage}
NODE_ENV: PRODUCTION
AWS_NODEJS_CONNECTION_REUSE_ENABLED: 1
LAMBDA_WRAPPER_LOG: true
DELETE_STACK_TOPIC: !Join
- ':'
- - arn:aws:sns
- !Ref AWS::Region
- !Ref AWS::AccountId
- delete-stack-${opt:stage, self:provider.stage}
thundra_apiKey: ${env:THUNDRA_TOKEN_SANDBOX, env:THUNDRA_TOKEN}
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:
webpackConfig: ./webpack.config.js
includeModules:
forceExclude:
- aws-sdk
package:
exclude:
- .git
- .env
- package-lock.json
- package.json
- README.md
- app/**/*/sample-data/**/*
excludeDevDependencies: true
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