RunR v0.6.0

Documentation

runr_api_consumer (Resource)

A consumer of the API product: someone who calls a gateway's API, such as a customer, identified by its API keys (runr_api_key) on key routes or by its JWT subject on JWT routes (consumers). A consumer belongs to a gateway or to the organization (accepted on every gateway; api_products.manage). Deleting it deletes its keys; its usage stays in the reports (runr gateway usage).

Import with the consumer id: terraform import runr_api_consumer.acme 01JC….

Example Usage#

# A customer of the gateway's API on the Pro plan; external_id is its number in the invoicing
# system that bills the usage.
resource "runr_api_consumer" "acme" {
  gateway_id  = runr_gateway.eu.id
  name        = "Acme Ltd"
  email       = "api@acme.example"
  external_id = "CUST-1042"
  plan_id     = runr_api_plan.pro.id
  metadata = {
    segment = "enterprise"
  }
}

# A partner identified by the subject of its JWTs on jwt routes, on every gateway of the
# organization (api_products.manage).
resource "runr_api_consumer" "partner" {
  name        = "Partner GmbH"
  jwt_subject = "partner-gmbh"
  plan_id     = runr_api_plan.trial.id
}

Schema#

Required#

  • name (String) Name, e.g. the customer's.

Optional#

  • email (String) Contact address (shown only to those who may manage the consumer).
  • external_id (String) The consumer's id in your own systems (the invoicing system's customer number): in the usage, the usage events and the X-Runr-Consumer-External header.
  • gateway_id (String) Gateway id (runr_gateway). Left out: a consumer of the organization, accepted on every gateway. Changing it creates a new consumer (with new keys).
  • jwt_subject (String) JWT routes: the claim value that names this consumer (unique among the consumers a gateway accepts).
  • metadata (Map of String) Up to 50 key / value pairs of your own.
  • plan_id (String) Its plan (runr_api_plan): one of the gateway's or of the organization's (an organization consumer: only the organization's). Left out: no limits beyond the gateway's IP rate limit.
  • status (String) active or suspended (every key gets 403 consumer_suspended). Left out: kept as it is (a new consumer is active).

Read-Only#

  • id (String) Consumer id.

Import#

Import is supported using the following syntax:

The terraform import command can be used, for example:

# <consumer id> (`runr gateway consumers` lists them)
terraform import runr_api_consumer.acme 01JCONSUMER0123456789ABCDE

RunR v0.6.0 · MIT License