This repository has been archived by the owner on Feb 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
66 lines (61 loc) · 1.69 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
service:
name: account-reaper
plugins:
- serverless-webpack
- serverless-step-functions
- serverless-secrets
provider:
name: aws
runtime: nodejs8.10
region: ap-southeast-2
tracing: true
environment: ${file(env.yml):${opt:stage}}
environmentSecrets:
SLACK_ACCESS_TOKEN: /account-reaper/${opt:stage}/SLACK_ACCESS_TOKEN
SLACK_HOOK: /account-reaper/${opt:stage}/SLACK_ACCESS_TOKEN
iamRoleStatements:
- Effect: Allow
Resource: arn:aws:ssm:*:*:parameter/*
Action:
- ssm:GetParameter
- ssm:PutParameter
- Effect: Allow
Resource: "*"
Action:
- organizations:ListAccounts
- Effect: Allow
Resource: "*"
Action:
- xray:PutTraceSegments
- xray:PutTelemetryRecords
custom:
serverlessSecrets:
providerOptions:
region: ap-southeast-2
keys:
default: alias/account_reaper_key
functions:
markAccounts:
handler: src/handler.markAccounts
notifySlack:
handler: src/handler.notifySlack
stepFunctions:
stateMachines:
accountReaper:
events:
- schedule: rate(30 days)
path: account_reaper
definition:
Comment: This is the account reaper
StartAt: Mark
States:
Mark:
Type: Task
Resource: arn:aws:lambda:#{AWS::Region}:#{AWS::AccountId}:function:${self:service}-${opt:stage}-markAccounts
ResultPath: $.markedAccounts
Next: Notify
Notify:
Type: Task
Resource: arn:aws:lambda:#{AWS::Region}:#{AWS::AccountId}:function:${self:service}-${opt:stage}-notifySlack
InputPath: $.markedAccounts
End: true