-
Notifications
You must be signed in to change notification settings - Fork 1
/
serverless.yml
102 lines (87 loc) · 2.83 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
service: owl
package:
individually: true
provider:
name: aws
timeout: 28
memorySize: 1024
runtime: nodejs12.x
profile: personal
region: eu-west-1
stage: ${self:custom.stage}
environment:
STAGE: ${self:custom.stage}
httpApi:
authorizers:
Authorizer:
identitySource: $request.header.Authorization
issuerUrl: !GetAtt UserPool.ProviderURL
audience: !Ref UserPoolClient
plugins:
- serverless-esbuild
- serverless-cloudformation-sub-variables
- serverless-export-outputs
- serverless-cloudside-plugin
- serverless-offline
custom:
stage: ${opt:stage, 'local'}
## Configure these with values from your aws account
CertArn: ${ssm:/aws/reference/secretsmanager/owl/certificate/arn~true}
HostedZoneName: serverlessowl.dev
## End of your configuration
Domains:
default: ${self:custom.stage}.${self:custom.HostedZoneName}
local: localhost:3000
production: ${self:custom.HostedZoneName}
Domain: ${self:custom.Domains.${self:custom.stage}, self:custom.Domains.default}
Callbacks:
default: https://${self:custom.Domain}
local: http://${self:custom.Domain}
Callback: ${self:custom.Callbacks.${self:custom.stage}, self:custom.Callbacks.default}
devExperiences:
default: cloud
local: local
devExperience: ${self:custom.devExperiences.${self:custom.stage}, self:custom.devExperiences.default}
exportOutputs:
reactapp: true
include:
- AwsRegion: eu-west-1
- UserPoolId
- UserPoolWebClientId
- IdentityPoolId
- LoginSubDomain
- CloudFrontDistribution
- HttpApiUrl
output:
file: ./.env
format: toml
resources:
# Cognito Resources
- ${file(./infrastructure/authentication/UserPool.yml)}
- ${file(./infrastructure/authentication/UserPoolClient.yml)}
- ${file(./infrastructure/authentication/HostedUi.yml)}
- ${file(./infrastructure/authentication/IdentityPool.yml)}
- ${file(./infrastructure/authentication/CognitoAuthorizedRole.yml)}
- ${file(./infrastructure/authentication/IdentityRoleMapping.yml)}
# Database Resources
- ${file(./infrastructure/database/Dynamo.yml)}
# Web Resources
- ${file(./infrastructure/web/Distribution.${self:custom.devExperience}.yml), ''}
- ${file(./infrastructure/web/RecordSets.${self:custom.devExperience}.yml), ''}
- ${file(./infrastructure/web/Bucket.${self:custom.devExperience}.yml), ''}
# Roles
- ${file(./functions/add-todo/role.yml)}
- ${file(./functions/get-todo/role.yml)}
# Outputs required by the frontend
- Outputs:
UserPoolId:
Value: !Ref UserPool
UserPoolWebClientId:
Value: !Ref UserPoolClient
IdentityPoolId:
Value: !Ref IdentityPool
LoginSubDomain:
Value: !Ref HostedUi
functions:
- ${file(./functions/add-todo/function.yml)}
- ${file(./functions/get-todo/function.yml)}