-
Notifications
You must be signed in to change notification settings - Fork 13
/
serverless.yml
109 lines (102 loc) · 2.78 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
app: nietzsche
service: nietzsche
configValidationMode: error
plugins:
- serverless-better-credentials
- serverless-step-functions
- serverless-pseudo-parameters
- serverless-plugin-include-dependencies
- serverless-plugin-optimize
package:
individually: true
include:
- src/assets/**/*
exclude:
- node_modules/**
- README.md
- LICENSE
- package.json
- package-lock.json
- scripts/**
- statemachine.png
- resources/**
custom:
optimize:
includePaths: ["src/assets"]
provider:
name: aws
runtime: nodejs16.x
profile: prod
region: eu-west-1
versionFunctions: false
stage: dev
tracing:
lambda: true
apiGateway: true
stackTags:
PROJECT: ${self:service}
STAGE: ${opt:stage, self:provider.stage}
environment:
DYNAMODB_TABLE: ${self:service}-${opt:stage, self:provider.stage}-quotes
SNS_SCRAP_TOPIC: ${self:service}-${opt:stage, self:provider.stage}-scrap
SQS_QUOTES: ${self:service}-${opt:stage, self:provider.stage}-quotes
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
- dynamodb:BatchWriteItem
Resource: "arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/${self:provider.environment.DYNAMODB_TABLE}"
- Effect: Allow
Action:
- sns:Publish
- sns:Subscribe
Resource:
{
"Fn::Join":
[
"",
[
"arn:aws:sns:${self:provider.region}:",
{ "Ref": "AWS::AccountId" },
":${self:provider.environment.SNS_SCRAP_TOPIC}",
],
],
}
- Effect: Allow
Action:
- sqs:SendMessage
- sqs:DeleteMessage
- sqs:ReceiveMessage
- sqs:GetQueueUrl
- sqs:ListQueues
Resource:
{
"Fn::Join":
[
"",
[
"arn:aws:sqs:${self:provider.region}:",
{ "Ref": "AWS::AccountId" },
":${self:provider.environment.SQS_QUOTES}",
],
],
}
functions:
- ${file(resources/functions/dispatchScrappers.yml)}
- ${file(resources/functions/scrapQuotes.yml)}
- ${file(resources/functions/saveQuotes.yml)}
- ${file(resources/functions/tweetQuoteText.yml)}
- ${file(resources/functions/getQuotesByAuthor.yml)}
- ${file(resources/functions/getRandomQuote.yml)}
- ${file(resources/functions/incrementUsedCounter.yml)}
- ${file(resources/functions/decideTweetMode.yml)}
resources:
- ${file(resources/dynamodb.yml)}
- ${file(resources/sns.yml)}
- ${file(resources/sqs.yml)}
stepFunctions: ${file(resources/stepfunction.yml)}