runr_env_var (Resource)
One environment variable of a project. Either kind reaches the running deployment with the next deploy: redeploy (runr_deployment.triggers) to apply a change.
- Plain variables (
secret = false) are part of the project config; each change saves a new project version. - Secret variables (
secret = true) are stored write-only through the project's secrets API: RunR lists their names, never their values, and they never appear in a version. Terraform keeps the value it set (value, sensitive) and notices when the variable is removed outside Terraform. Withvalue_wo(Terraform 1.11 and later) the value is not stored in the state either; changevalue_wo_versionto write a new value. - References (
reference) are secret variables whose value lives in a secret store of the organization (runr_secret_store): RunR never sees it, External Secrets Operator reads it in the project's region. A reference changed into a value outside Terraform (or the other way round) shows as a change.
A name is plain or secret, never both; switching secret recreates the variable. Switching a secret variable between a value and a reference changes it in place. Import with <project name or id>/<NAME>: a secret variable without its value, a reference with it.
Example Usage#
resource "runr_env_var" "log_level" {
project_id = runr_project.api.id
name = "LOG_LEVEL"
value = "info"
}
# A secret variable: stored write-only, listed by name only. Terraform keeps the value it set
# (sensitive) and recreates the variable when it is removed outside Terraform.
resource "runr_env_var" "database_url" {
project_id = runr_project.api.id
name = "DATABASE_URL"
value = var.database_url
secret = true
}
# Terraform 1.11 and later: value_wo never reaches the state; bump value_wo_version to write a
# new value (for example after a rotation).
resource "runr_env_var" "signing_key" {
project_id = runr_project.api.id
name = "SIGNING_KEY"
value_wo = var.signing_key
value_wo_version = "2026-10"
secret = true
}
# A secret variable whose value lives in a secret store: RunR never sees it, External Secrets
# Operator reads it in the project's region (secret = true is implied).
resource "runr_env_var" "db_password" {
project_id = runr_project.api.id
name = "DB_PASSWORD"
reference = {
store = runr_secret_store.vault.id
path = "apps/orders"
key = "db_password"
}
}
variable "database_url" {
type = string
sensitive = true
}
variable "signing_key" {
type = string
sensitive = true
ephemeral = true
}
Schema#
Required#
name(String) Variable name.project_id(String) Project id.
Optional#
NOTE: Write-only arguments are supported in Terraform 1.11 and later.
reference(Attributes) The value lives in a secret store of the organization: a secret variable that refers to it instead of avalue(secret stores). The variable reaches the workload with the next deploy, as External Secrets Operator syncs it in the project's region. (see below for nested schema)secret(Boolean) Store the value as a write-only secret variable (defaultfalse; areferenceis always a secret variable, so it defaults totruewith one and cannot befalse). Changing it recreates the variable.value(String, Sensitive) Value (sensitive). Exactly one ofvalue,value_woandreferenceis required.value_wo(String, Sensitive, Write-only) Value of a secret variable that Terraform never stores (write-only attribute, Terraform 1.11 and later; needssecret = true). Terraform cannot compare it, so changevalue_wo_versionto write a new value.value_wo_version(String) Any string; a change writesvalue_woagain (for example a rotation date).
Read-Only#
id(String)<project_id>/<name>.
Nested Schema for reference#
Required:
path(String) Path of the secret in the store: a Vault / OpenBao KV path (apps/orders), an AWS secret name or ARN, a GCP secret name, an Azure Key Vault secret name.store(String) The store: its id or name. Userunr_secret_store.<name>.id, so Terraform creates the store before the variable and deletes it after (a store a variable refers to cannot be deleted).
Optional:
key(String) Key inside the secret (a field of a JSON or KV secret); left out: the whole secret.
Import#
Import is supported using the following syntax:
The terraform import command can be used, for example:
# <project name or id>/<variable name>
terraform import runr_env_var.log_level orders-api/LOG_LEVEL
# A secret variable is imported with secret = true and without its value (RunR never returns
# it); the next apply writes the value of the configuration.
terraform import runr_env_var.database_url orders-api/DATABASE_URL
# A reference to a secret store is imported with its store, path and key.
terraform import runr_env_var.db_password orders-api/DB_PASSWORD