RunR v0.5.7

Documentation

runr_binding (Resource)

A binding of the organization: a managed kv store (Redis), object storage (S3), a postgres database, or external credentials. Attach it to projects with runr_binding_attachment; its connection details reach the functions as environment variables.

Credentials are never part of the state: the API returns them only from runr bindings credentials (permission bindings.view_credentials, audited). The values of an external binding are write-only: Terraform keeps what it set.

Destroying the resource deletes the binding with retention: it is detached at once and its data is kept for the retention period (runr bindings restore brings it back). Its name stays taken until the data is purged, so a replacement needs a new name.

Example Usage#

# A KV store on the region's Redis: a user limited to its own key prefix.
resource "runr_binding" "cache" {
  name      = "cache"
  type      = "kv"
  region_id = data.runr_region.eu.id
  memory_mb = 128
}

# A Postgres database on the region's shared CloudNativePG cluster.
resource "runr_binding" "orders_db" {
  name              = "orders-db"
  type              = "postgres"
  region_id         = data.runr_region.eu.id
  storage_gb        = 2
  connection_limit  = 10
  statement_timeout = "15s"
}

# A dedicated Postgres cluster with a replica and daily backups.
resource "runr_binding" "reports_db" {
  name       = "reports-db"
  type       = "postgres"
  plan       = "dedicated"
  region_id  = data.runr_region.eu.id
  storage_gb = 20
  instances  = 2
  backups    = true
  timeout    = "20m"
}

# An S3 bucket with a quota and a key allowed on that bucket only.
resource "runr_binding" "files" {
  name      = "files"
  type      = "object"
  region_id = data.runr_region.eu.id
  quota_gb  = 10
}

# Credentials you bring, injected as they are (write-only).
resource "runr_binding" "payments" {
  name = "payments"
  type = "external"
  values = {
    PAYMENTS_URL   = "https://pay.example.com"
    PAYMENTS_TOKEN = var.payments_token
  }
}

variable "payments_token" {
  type      = string
  sensitive = true
}

Schema#

Required#

  • name (String) Name (lower case letters, digits and -, at most 30 characters; unique in the organization).
  • type (String) kv, object, postgres or external.

Optional#

  • backups (Boolean) postgres dedicated: daily base backup and WAL archive to the region object store (default off).
  • connection_limit (Number) postgres: connections of the role and the database (default 20).
  • instances (Number) postgres dedicated: 1 primary plus replicas, up to 3 (default 1).
  • memory_mb (Number) kv: memory the binding's keys may use (default 64); above it the user can only read and delete.
  • plan (String) postgres: shared (default; a database on the region's shared cluster) or dedicated (a cluster of its own). Other types: computed.
  • quota_gb (Number) object: bucket quota in GB (default 5).
  • region_id (String) Region of a kv, object or postgres binding (required for those; external bindings have none). It can be attached to projects of that region.
  • statement_timeout (String) postgres: statement_timeout of the role (default 30s).
  • storage_gb (Number) postgres: size limit (shared, default 1) or volume size per instance (dedicated, default 5; it can only grow).
  • timeout (String) How long wait waits (Go duration); a dedicated Postgres cluster takes a few minutes.
  • values (Map of String, Sensitive) external: the variables to inject (names upper case, digits and _). Write-only: Terraform keeps what it set; changing them updates the attached projects.
  • wait (Boolean) Wait at create until the binding is provisioned (ready).

Read-Only#

  • env_keys (List of String) Variables an attachment injects (without its prefix).
  • id (String) Binding id.
  • over_quota (Boolean) The binding is over its size limit: writes are refused until data is deleted or the limit is raised.
  • resource_name (String) Name of the binding's resources on the data service (bucket, Redis user, database).
  • status (String) provisioning, ready, rotating or error.
  • status_message (String) Reason of an error status.

Import#

Import is supported using the following syntax:

The terraform import command can be used, for example:

# <binding name or id>
terraform import runr_binding.orders_db orders-db

RunR v0.5.7 · MIT License