aboutsummaryrefslogtreecommitdiffhomepage
path: root/serverless.yml
blob: 95e5a88743e9cf9af70f4cc167eaa0e731b2fe12 (plain) (blame)
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
service: serverless-oauth2
provider:
  name: aws
  runtime: nodejs10.x
  stage: ${opt:stage, self:custom.defaultStage}
  environment:
    GIT_HOSTNAME: "/pbonaud/oauth/${opt:stage, self:provider.stage}/GIT_HOSTNAME"
    OAUTH_TOKEN_PATH: "/pbonaud/oauth/${opt:stage, self:provider.stage}/OAUTH_TOKEN_PATH"
    OAUTH_AUTHORIZE_PATH: "/pbonaud/oauth/${opt:stage, self:provider.stage}/OAUTH_AUTHORIZE_PATH"
    OAUTH_CLIENT_ID: "/pbonaud/oauth/${opt:stage, self:provider.stage}/OAUTH_CLIENT_ID"
    OAUTH_CLIENT_SECRET:  "/pbonaud/oauth/${opt:stage, self:provider.stage}/OAUTH_CLIENT_SECRET"
    REDIRECT_URL: "/pbonaud/oauth/${opt:stage, self:provider.stage}/REDIRECT_URL"
    OAUTH_SCOPES: "/pbonaud/oauth/${opt:stage, self:provider.stage}/OAUTH_SCOPES"
    TZ: "utc"
  iamRoleStatements:
    - Effect: Allow
      Action:
        - ssm:DescribeParameters
        - ssm:GetParameters
      Resource: "arn:aws:ssm:${opt:region, self:provider.region}:*:parameter/pbonaud/oauth/${opt:stage, self:provider.stage}/*"
    - Effect: Allow
      Action:
        - kms:Decrypt
      Resource: "arn:aws:kms:${opt:region, self:provider.region}:*:key/${self:custom.kms_key.${opt:region, self:provider.region}.${self:provider.stage}}"

custom:
  defaultStage: dev
  kms_key:
    "eu-west-1":
      prod: "4c50d94e-061d-4034-b63f-507eb31b4fe7"
      dev: "foo"

functions:
  auth:
    handler: auth.auth
    memorySize: 128
    timeout: 5
    events:
      - http:
          path: /auth
          method: get
          cors: true
  callback:
    handler: auth.callback
    memorySize: 128
    timeout: 5
    events:
      - http:
          path: /callback
          method: get
          cors: true

plugins:
  - serverless-plugin-optimize
  - serverless-offline

package:
  individually: true