-
Notifications
You must be signed in to change notification settings - Fork 2
/
serverless.yml
110 lines (99 loc) · 2.31 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
service: ahv-council-mailer
provider:
name: aws
runtime: nodejs10.x
stage: ${opt:stage}
region: us-west-2
environment: ${file(env.${opt:stage}.yml)}
iamRoleStatements:
- Effect: "Allow"
Action:
- "ses:SendEmail"
- "ses:SendRawEmail"
Resource: "*"
- Effect: "Allow"
Action:
- "s3:GetBucketLocation"
- "s3:GetObject"
- "s3:ListBucket"
- "s3:ListBucketMultipartUploads"
- "s3:ListMultipartUploadParts"
- "s3:AbortMultipartUpload"
- "s3:PutObject"
Resource:
- arn:aws:s3:::${file(env.${opt:stage}.yml):S3_LOGGING_BUCKET}
- arn:aws:s3:::${file(env.${opt:stage}.yml):S3_LOGGING_BUCKET}/*
- Effect: "Allow"
Action:
- "glue:GetTable"
Resource: "*"
- Effect: "Allow"
Action:
- "athena:*"
Resource: "*"
- Effect: 'Allow'
Action:
- "sns:Publish"
Resource:
- ${self:custom.ahvSlashTaskQueue}
custom:
ahvSlashTaskQueue:
Fn::Join:
- ":"
-
- "arn:aws:sns"
- Ref: AWS::Region
- Ref: AWS::AccountId
- ahvSlashTasks-${opt:stage}
resources:
Conditions:
CreateS3Bucket:
Fn::Not:
- Fn::Equals:
- ${file(env.${opt:stage}.yml):S3_LOGGING_BUCKET}
- ""
Resources:
S3LoggingBucket:
Type: "AWS::S3::Bucket"
Condition: "CreateS3Bucket"
Properties:
BucketName: ${file(env.${opt:stage}.yml):S3_LOGGING_BUCKET}
functions:
createLetter:
handler: src/createLetter.entryPoint
events:
- http:
path: submit
method: post
private: false
cors: true
approveLetter:
handler: src/approveLetter.entryPoint
events:
- http:
path: approve
method: post
private: false
slash:
handler: src/slash.invokeSlashCommand
events:
- http:
path: slash
method: post
private: false
environment:
SLASH_TOPIC: ${self:custom.ahvSlashTaskQueue}
processSlashCommand:
handler: src/slash.processSlashCommand
events:
- sns: ahvSlashTasks-${opt:stage}
timeout: 180
plugins:
- serverless-mocha-plugin
package:
exclude:
- tmp/**
- env.*.yml
- athena-table.sql
include:
- env.${opt:stage}.yml