service: issuing-gateway
provider:
  name: aws
  region: eu-central-1
  runtime: provided.al2
  stage: prod

plugins:
  - ./vendor/bref/bref

# Exclude files from deployment
package:
  exclude:
    - 'node_modules/**'
    - 'tests/**'
    - '.env.local'
functions:
  api:
    name: 'issuing-gateway'
    environment:
      APP_ENV: 'prod'
      GIT: 'fc811ff574cf287624b9f38712748d69167211b5'
      DATABASE_URL: '${ssm:/database/pci-dsn}/instances'
      GPS_INTEGRATION_SERVICE: '${ssm:/services/prod/gps-integration}'
      CARD_SERVICE: '${ssm:/services/prod/card_v2}'
      DIGITIZATION_SERVICE: '${ssm:/services/prod/digitization}'
      INSTANCE_SERVICE: '${ssm:/services/prod/instance}'
      MERCHANT_SERVICE: '${ssm:/services/prod/merchant}'
      INTERNAL_PASSWORD: '${ssm:/issuing-gateway/internal-password}'
      # Services URI
    handler: public/index.php
    description: 'Instance Service'
    timeout: 28 # in seconds (API Gateway has a timeout of 29 seconds)
    layers:
      - ${bref:layer.php-81-fpm}
    events:
      - alb:
          listenerArn: '${ssm:/issuing-gateway/alb}'
          priority: 1
          multiValueHeaders: true
          conditions:
            path: /
      - schedule:
          rate: rate(5 minutes)
          input:
            warmer: true
    vpc:
      securityGroupIds:
        - '${ssm:/issuing-gateway/sg}'
      subnetIds:
        - '${ssm:/private-subnet-c}'
        - '${ssm:/private-subnet-d}'

