-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
126 lines (118 loc) · 3.56 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
service: badger
frameworkVersion: ">=1.11.0 <2.0.0"
provider:
stage: ${opt:stage, 'dev'}
deploymentBucket:
name: com.zaclang.badger.${self:provider.region}.deploys
serverSideEncryption: AES256
accelerate: true
blockPublicAccess: true
name: aws
runtime: nodejs12.x
region: us-east-1
endpointType: regional
versionFunctions: false
environment:
AWS_NODEJS_CONNECTION_REUSE_ENABLED: 1
STAGE: ${self:provider.stage}
USER_TABLE_NAME: ${self:custom.userTableName}
USER_EMAIL_INDEX_NAME: ${self:custom.userEmailIndexName}
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:DescribeTable
- dynamodb:PutItem
- dynamodb:Query
- dynamodb:DeleteItem
Resource:
- arn:aws:dynamodb:#{AWS::Region}:#{AWS::AccountId}:table/${self:custom.userTableName}
- arn:aws:dynamodb:#{AWS::Region}:#{AWS::AccountId}:table/${self:custom.userTableName}/*
- arn:aws:dynamodb:#{AWS::Region}:#{AWS::AccountId}:table/${self:custom.userTableName}/index/*
- Effect: Allow
Action:
- ssm:GetParameters
Resource:
- arn:aws:ssm:#{AWS::Region}:#{AWS::AccountId}:parameter/${self:provider.stage}/badger/config/*
- arn:aws:ssm:#{AWS::Region}:#{AWS::AccountId}:parameter/${self:provider.stage}/badger/secret/*
custom:
serverless-layers:
packageManager: yarn
dependenciesPath: ./package.json
userTableName: user-${self:provider.stage}
userEmailIndexName: user-email-index-${self:provider.stage}
customDomain:
domainName: badger.zaclang.com
stage: ${opt:stage}
certificateName: "*.zaclang.com"
basePath: api
createRoute53Record: false
endpointType: 'regional'
package:
exclude:
- package*.json
- sample*
- readme.md
plugins:
- serverless-offline
- serverless-pseudo-parameters
- serverless-step-functions
- serverless-domain-manager
- serverless-layers
- serverless-deployment-bucket
functions:
registration:
handler: src/handlers/registration.handler
events:
- http:
path: register
method: post
cors: true
hello:
handler: src/handlers/hello.handler
events:
- http:
path: hello
method: get
cors: true
buildkite:
handler: src/handlers/parse-buildkite-event.handler
notify:
handler: src/handlers/notify.handler
stepFunctions:
stateMachines:
buildkiteEvent:
name: myStateMachine
definition:
Comment: "this is a comment"
StartAt: ParseBuildkiteEvent
States:
ParseBuildkiteEvent:
Type: Task
Resource: "arn:aws:lambda:#{AWS::Region}:#{AWS::AccountId}:function:${self:service}-${opt:stage}-buildkite"
Next: NotifyStakeholders
NotifyStakeholders:
Type: Task
Resource: "arn:aws:lambda:#{AWS::Region}:#{AWS::AccountId}:function:${self:service}-${opt:stage}-notify"
End: true
resources:
Resources:
UserTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:custom.userTableName}
AttributeDefinitions:
- AttributeName: userId
AttributeType: S
- AttributeName: email
AttributeType: S
KeySchema:
- AttributeName: userId
KeyType: HASH
BillingMode: PAY_PER_REQUEST
GlobalSecondaryIndexes:
- IndexName: ${self:custom.userEmailIndexName}
KeySchema:
- AttributeName: email
KeyType: HASH
Projection:
ProjectionType: 'ALL'