RunR v0.5.7

Documentation

runr_binding_attachment (Resource)

Attaches a runr_binding to a project: the binding's connection details reach the project's functions as environment variables (with env_prefix in front, e.g. ORDERS_DATABASE_URL). Attaching, changing the prefix and detaching roll the running service; nothing needs to be redeployed.

A kv, object or postgres binding can be attached to projects of its region; external bindings to any project. Needs env.edit on the project and bindings.manage.

Example Usage#

# orders-api gets ORDERS_DATABASE_URL, ORDERS_PGHOST, … and REDIS_URL, KV_PREFIX.
resource "runr_binding_attachment" "orders_db" {
  project_id = runr_project.api.id
  binding_id = runr_binding.orders_db.id
  env_prefix = "ORDERS_"
}

resource "runr_binding_attachment" "cache" {
  project_id = runr_project.api.id
  binding_id = runr_binding.cache.id
}

output "binding_variables" {
  value = concat(runr_binding_attachment.orders_db.env_names, runr_binding_attachment.cache.env_names)
}

Schema#

Required#

  • binding_id (String) Binding id (runr_binding.<name>.id).
  • project_id (String) Project id.

Optional#

  • env_prefix (String) Prefix of the variable names: upper case letters, digits and _, starting with a letter and ending with _ (default: none). Changing it updates the attachment in place.

Read-Only#

  • env_names (List of String) The variables the project gets from this attachment.
  • id (String) Attachment id.

Import#

Import is supported using the following syntax:

The terraform import command can be used, for example:

# <project name or id>/<binding name or id>
terraform import runr_binding_attachment.orders_db orders-api/orders-db

RunR v0.5.7 · MIT License