name: "exordos_com_https"
description: "Exordos https"
schema_version: 1
version: "0.0.32"
api_version: "v1"

requirements:
  core:
    from_version: "0.0.0"

imports:
  core_lb:
    element: "$core"
    kind: "resource"
    link: "$core.network.lb.$core_lb"

resources:
  $core.secret.certificates:
    core_cert:
      name: "wildcard-core-cert-prod"
      project_id: "12345678-c625-4fee-81d5-f691897b8142"
      email: "infra@exordos.com"
      method:
        kind: dns_core
      domains:
        - "*.exordos.io"
        - "exordos.io"

  $exordos_com_https.imports.$core_lb.backend_pools:
   core_lb_nginx_http:
     project_id: "12345678-c625-4fee-81d5-f691897b8142"
     parent: $exordos_com_https.imports.$core_lb:uuid
     endpoints:
       - kind: host
         host: 127.0.0.1
         port: 80
         weight: 1

  $exordos_com_https.imports.$core_lb.vhosts:
    core_lb_exordos_com_https:
      cert:
        crt: $core.secret.certificates.$core_cert:cert
        key: $core.secret.certificates.$core_cert:key
        kind: raw
      port: 443
      parent: $exordos_com_https.imports.$core_lb:uuid
      domains:
      - _
      protocol: https
      project_id: 12345678-c625-4fee-81d5-f691897b8142
      
  # $exordos_com_https.imports.$core_lb.vhosts.$core_lb_exordos_com_https.routes:
  $core.network.lb.$core_lb.vhosts.$core_lb_exordos_com_https.routes:
    core_lb_exordos_com_https_route:
      project_id: "12345678-c625-4fee-81d5-f691897b8142"
      # parent: $exordos_com_https.imports.$core_lb.vhosts.$core_lb_exordos_com_https:uuid
      parent: $core.network.lb.$core_lb.vhosts.$core_lb_exordos_com_https:uuid
      condition:
        kind: prefix
        value: /
        actions:
          - kind: backend
            pool: $core.network.lb.$core_lb.backend_pools.$core_lb_nginx_http:uuid
            protocol:
              kind: http
        modifiers:
          - kind: auto_header
            headers:
              - 'Host'
              - 'X-Forwarded-For'
              - 'X-Forwarded-Port'
              - 'X-Forwarded-Proto'
              - 'X-Forwarded-Prefix'
        allowed_ips:
          - 0.0.0.0/0