RunR v0.6.0

Documentation

runr_gateway (Resource)

Your API gateway in a region (API product): https://<user>.<region>.<base domain> or its custom domain, routing by path to projects (runr_gateway_route). Every member has one gateway per region: the resource takes the existing one or creates it, and manages its IP rate limit, public developer page and custom domain.

The API cannot delete a gateway: destroying the resource resets what it manages (no rate limit, no developer page, no description, no custom domain) and forgets the gateway; its routes, consumers and plans are resources of their own.

Import with the gateway id or the name or id of its region: terraform import runr_gateway.eu eu-1.

Example Usage#

# Your gateway in eu-1 (taken over when you have one there): an IP rate limit, the public
# developer page and a custom domain.
resource "runr_gateway" "eu" {
  region_id      = data.runr_region.eu.id
  rate_limit     = { average = 100, burst = 200 }
  developer_page = true
  description    = "The Orders API of Example Ltd."
  custom_domain  = "api.example.com"
}

# While the domain waits, publish these records at your DNS provider, then set verify = true
# (or run `runr gateway domain verify eu-1`).
output "domain_records" {
  value = {
    verification = runr_gateway.eu.custom_domain_verification
    targets      = runr_gateway.eu.custom_domain_dns_targets
  }
}

output "developer_page" {
  value = runr_gateway.eu.developer_page_url
}

Schema#

Required#

  • region_id (String) Region id (data.runr_region). The gateway routes to the workloads that run there. Changing it manages the gateway of the other region.

Optional#

  • custom_domain (String) The gateway's own domain, e.g. api.example.com. It waits until RunR finds the TXT record (custom_domain_verification) and one of the records in custom_domain_dns_targets, then the routes answer on it (verify = true waits for that, or run runr gateway domain verify). Changing it requests the new name, the verified one serves until the new one verifies. Left out: none (a domain the gateway has is removed).
  • description (String) Text of the developer page. Left out: kept as it is; "" removes it.
  • developer_page (Boolean) Publish the public developer page at developer_page_url: the description, base URLs, routes and how to send a key or token, without sign-in. Left out: kept as it is (a new gateway has none).
  • developer_page_metrics (Boolean) The developer page also shows each key or JWT route's success rate and latency of the last 7 days (never call counts or consumers). Left out: kept as it is (default false).
  • rate_limit (Attributes) Rate limit per client IP for every route of the gateway (Traefik, requests per second). Left out: none (a limit the gateway has is removed). (see below for nested schema)
  • verify (Boolean) Wait until the custom domain is verified (default false). While the domain waits, every plan checks it again.
  • verify_timeout (String) How long verify waits (Go duration, default 10m).

Read-Only#

  • custom_domain_dns_targets (List of Object) Records that route the domain to the gateway, any one of them (type, name, value: a CNAME to host, or an address of the region), while the domain waits. (see below for nested schema)
  • custom_domain_verification (Attributes) The TXT record that proves the domain (type, name, value), while it waits. (see below for nested schema)
  • custom_domain_verified (Boolean) Whether custom_domain is verified and served.
  • developer_page_key (String) Key of the developer page, while it is published.
  • developer_page_url (String) URL of the developer page, while it is published.
  • host (String) Default host of the gateway.
  • id (String) Gateway id.
  • status (String) active, pending or error (e.g. the key and JWT routes answer 503 until the region's gateway-auth is ready).
  • status_message (String) Why the gateway is pending or in error.
  • subdomain (String) Subdomain (your user name).

Nested Schema for rate_limit#

Required:

  • average (Number) Requests per second (1-100000).

Optional:

  • burst (Number) Requests at once (1-100000). Left out: average for a new limit or a changed average, else the gateway's burst stays.

Nested Schema for custom_domain_dns_targets#

Read-Only:

  • name (String)
  • type (String)
  • value (String)

Nested Schema for custom_domain_verification#

Read-Only:

  • name (String) Record name (_runr-challenge.<domain>).
  • type (String) TXT.
  • value (String) Record value (runr-verify=<token>).

Import#

Import is supported using the following syntax:

The terraform import command can be used, for example:

# <gateway id, or the name or id of its region>
terraform import runr_gateway.eu eu-1

RunR v0.6.0 · MIT License