-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.ts
67 lines (62 loc) · 1.86 KB
/
serverless.ts
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
import type { AWS } from '@serverless/typescript';
import getTodos from '@functions/http/getTodos';
import createTodo from '@functions/http/createTodo';
import generateUploadUrl from '@functions/http/generateUploadUrl'
import auth0Authorizer from '@functions/auth/auth0Authorizer'
import {BucketPolicy, AttachmentsBucket} from '@resources/s3'
import {TodosTable} from '@resources/dynamoDb'
import deleteTodo from '@functions/http/deleteTodo'
import updateTodo from '@functions/http/updateTodo'
const serverlessConfiguration: AWS = {
service: 'serverless-todo-app',
variablesResolutionMode: "20210326",
frameworkVersion: '2',
custom: {
webpack: {
webpackConfig: './webpack.config.js',
includeModules: true,
},
todoSecrets: "${ssm:/aws/reference/secretsmanager/todo/app}",
},
plugins: [
'serverless-webpack',
'serverless-iam-roles-per-function'],
provider: {
name: 'aws',
runtime: 'nodejs14.x',
stage: "${opt:stage, 'dev'}",
region: 'eu-central-1',
apiGateway: {
minimumCompressionSize: 1024,
shouldStartNameWithService: true,
},
tracing: {
lambda: true,
apiGateway: true
},
environment: {
AWS_NODEJS_CONNECTION_REUSE_ENABLED: '1',
TODOS_TABLE: "${self:custom.todoSecrets.tableName}${self:provider.stage}",
TODO_ID_INDEX: "${self:custom.todoSecrets.todoIndex}${self:provider.stage}",
TODOS_S3_BUCKET: "${self:custom.todoSecrets.s3Endpoint}${self:provider.stage}",
JWKS: "${self:custom.todoSecrets.jwksUrl}"
},
lambdaHashingVersion: '20201221',
},
// import the function via paths
functions: {
getTodos,
auth0Authorizer,
createTodo,
generateUploadUrl,
deleteTodo,
updateTodo },
resources: {
Resources: {
TodosTable,
AttachmentsBucket,
BucketPolicy
},
}
};
module.exports = serverlessConfiguration;