-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathserverless.yml
116 lines (106 loc) · 3.26 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
service: slack-signup
frameworkVersion: ">=1.2.0 <2.0.0"
custom:
private: ${file(./private.yml)}
apigs3:
dist: web
topFiles: true
provider:
name: aws
runtime: python2.7
environment:
DYNAMODB_TABLE: ${self:service}-${opt:stage, self:provider.stage}
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource: "arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/${self:provider.environment.DYNAMODB_TABLE}"
package:
individually: true
exclude:
- ./**
functions:
InviteSlack:
handler: invite_slack/handler.endpoint
package:
include:
- invite_slack/**
environment: ${file(env.yml):slack}
RecordDB:
handler: record_db/handler.endpoint
package:
include:
- record_db/**
RecordAC:
handler: record_ac/handler.endpoint
package:
include:
- record_ac/**
environment: ${file(env.yml):active_campaign}
stepFunctions:
stateMachines:
signup:
events:
- http:
path: signup
method: POST
cors: true # Wish it worked but it does NOT: https://github.com/horike37/serverless-step-functions/issues/37
definition: # ${file(workflow.yml)} - doesn't work, why?
Comment: "Community sign-up workflow"
StartAt: RecordDB
States:
RecordDB:
Type: Task
Resource: arn:aws:lambda:${self:custom.private.region}:${self:custom.private.accountId}:function:${self:service}-dev-RecordDB
Next: RecordAC
ResultPath: $.results.RecordDB
RecordAC:
Type: Task
Resource: arn:aws:lambda:${self:custom.private.region}:${self:custom.private.accountId}:function:${self:service}-dev-RecordAC
Next: InviteSlack
ResultPath: $.results.RecordAC
InviteSlack:
Type: Task
# Resource: ${self.resources.Outputs.InviteSlackLambdaArn.Value} too bad this doesn't work, chicken-n-egg problem
Resource: arn:aws:lambda:${self:custom.private.region}:${self:custom.private.accountId}:function:${self:service}-dev-InviteSlack
ResultPath: $.results.InviteSlack
End: true
resources:
Resources:
UsersDynamoDbTable:
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Retain
Properties:
AttributeDefinitions:
-
AttributeName: email
AttributeType: S
KeySchema:
-
AttributeName: email
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: ${self:provider.environment.DYNAMODB_TABLE}
Outputs:
InviteSlackLambdaName:
Description: Invite Slack Lambda function name
Value:
Ref: InviteSlackLambdaFunction
Export:
Name: ${self:service}-FunctionName
InviteSlackLambdaArn:
Description: The Name of the Photo Assignments Fail Lambda
Value:
'Fn::GetAtt': [ InviteSlackLambdaFunction, Arn ]
Export:
Name: ${self:service}-FunctionArn
plugins:
- serverless-step-functions
- serverless-apig-s3