forked from manwaring-automation/odin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverless.yml
More file actions
93 lines (85 loc) · 3.1 KB
/
serverless.yml
File metadata and controls
93 lines (85 loc) · 3.1 KB
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
87
88
89
90
91
92
93
service:
name: odin
plugins:
- serverless-plugin-epsagon
- serverless-webpack
- serverless-cloudformation-resource-counter
- serverless-stack-output
provider:
name: aws
runtime: nodejs8.10
stage: local
environment:
REVISION: ${file(infrastructure/helper.js):revision}
STAGE: ${opt:stage, self:provider.stage}
DELETE_STACK_TOPIC:
Fn::Join:
- ':'
- - arn:aws:sns
- Ref: AWS::Region
- Ref: AWS::AccountId
- delete-stack-${opt:stage, self:provider.stage}
iamRoleStatements:
- Effect: Allow
Resource: '*'
Action: '*'
custom:
epsagon:
token: ${env:EPSAGON_TOKEN}
appName: ${self:service.name}-${opt:stage, self:provider.stage}
odin: ${file(./odin.yml)}
# output is used by the serverless-stack-output plugin
output: { file: ./infrastructure/stack-outputs.yml }
functions:
checkStacks:
handler: app/check.handler
events:
- schedule:
rate: ${self:custom.odin.dailyRate}
input:
staleAfter: ${self:custom.odin.dailyStaleAfter}
stagesToRetain: ${self:custom.odin.stagesToRetain}
deleteableStatuses: ${self:custom.odin.deleteableStatuses}
namesToRetain: ${self:custom.odin.namesToRetain}
- schedule:
rate: ${self:custom.odin.hourlyRate}
input:
staleAfter: ${self:custom.odin.hourlyStaleAfter}
stagesToRetain: ${self:custom.odin.stagesToRetain}
deleteableStatuses: ${self:custom.odin.deleteableStatuses}
namesToRetain: ${self:custom.odin.namesToRetain}
deleteStacks:
handler: app/delete.handler
events:
- sns: delete-stack-${opt:stage, self:provider.stage}
environment:
EMPTY_ALL_BUCKETS: ${self:custom.odin.emptyAllBuckets}
BUCKETS_TO_EMPTY: ${self:custom.odin.bucketsToEmpty}
resources:
Description: Automated service for destroying temporary stacks (retains permanenent stacks)
Outputs:
DailySchedule:
Description: Schedule for daily jobs and maximum stack age in hours before deletion
Value: ${self:custom.odin.dailyRate}, max ${self:custom.odin.dailyStaleAfter} hours
HourlySchedule:
Description: Schedule for hourly jobs and maximum stack age in hours before deletion
Value: ${self:custom.odin.hourlyRate}, max ${self:custom.odin.hourlyStaleAfter} hours
StackNamesToRetain:
Description: Names of stacks that will be retained
Value: In ${self:custom.odin.namesToRetain}
StagesToRetain:
Description: Stages of stacks that will be retained
Value: In ${self:custom.odin.stagesToRetain}
StatusesToRetain:
Description: Statuses of stacks that will be retained
Value: Not in ${self:custom.odin.deleteableStatuses}
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