-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserverless.yml
120 lines (110 loc) · 3.17 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
service: planner
plugins:
- serverless-webpack
- serverless-offline
- serverless-dynamodb-local
- serverless-dotenv-plugin
provider:
name: aws
runtime: nodejs8.10
stage: dev
region: ap-northeast-1
timeout: 30 # 最大30秒
environment:
# node process.envに引き渡す値 nestしたobjectは渡せないので注意
stage: ${opt:stage, self:provider.stage}
region: ${self:provider.region}
localDynamoPort: ${self:custom.localDynamoPort}
dynamoJiraTickets: ${self:custom.dynamodb.tables.jiraTickets}
dynamoSyncTables: ${self:custom.dynamodb.tables.syncTables}
dynamoJiraBoards: ${self:custom.dynamodb.tables.jiraBoards}
dynamoJiraSprints: ${self:custom.dynamodb.tables.jiraSprints}
dynamoWatchingEpics: ${self:custom.dynamodb.tables.watchingEpics}
# Secret情報 (.envから取得)
jiraHost: ${env:JIRA_HOST}
jiraUser: ${env:JIRA_USER}
jiraSecret: ${env:JIRA_SECRET}
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:DescribeTable
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource:
- "Fn::GetAtt": [ jiraTickets, Arn ]
- "Fn::GetAtt": [ syncTable, Arn ]
- "Fn::GetAtt": [ jiraBoards, Arn ]
- "Fn::GetAtt": [ jiraSprints, Arn ]
- "Fn::GetAtt": [ watchingEpics, Arn ]
- Fn::Join:
- "/"
-
- { "Fn::GetAtt": [ jiraTickets , Arn ] }
- "index/*"
- Effect: Allow
Action:
- lambda:InvokeFunction
Resource: "*"
package:
excludeDevDependencies: true
exclude:
- serverless-http
custom:
stage: ${opt:stage, self:provider.stage}
webpackIncludeModules: true
localDynamoPort: 3030
serverless-offline:
port: 3100
webpack:
webpackConfig: 'webpack.config.js'
packager: 'yarn'
packagerOptions: {}
dynamodb:
tables:
jiraTickets: ${self:custom.stage}-planner_jira_tickets
syncTables: ${self:custom.stage}-planner_sync_tables
jiraBoards: ${self:custom.stage}-planner_jira_boards
jiraSprints: ${self:custom.stage}-planner_jira_sprints
watchingEpics: ${self:custom.stage}-planner_watching_epics
start:
port: ${self:custom.localDynamoPort}
inMemory: true
migrate: true
seed: true
seed:
development:
sources:
- table: ${self:custom.dynamodb.tables.jiraTickets}
sources: [./resources/seeds/testTickets.json]
- table: ${self:custom.dynamodb.tables.jiraSprints}
sources: [./resources/seeds/testSprints.json]
functions:
app:
handler: app.handler
events:
- http:
method: ANY
path: '/'
cors: true
- http:
method: ANY
path: '{proxy+}'
cors: true
syncBoardJob:
handler: src/jobs/syncBoardJob.handler
timeout: 300
memorySize: 128
syncSprintJob:
handler: src/jobs/syncSprintJob.handler
timeout: 300
memorySize: 128
syncTicketJob:
handler: src/jobs/syncTicketJob.handler
timeout: 300
memorySize: 128
resources:
- ${file(resources/dynamodb-table.yml)}