scalr_variable
Resource: scalr_variable
Manages the state of variables in Scalr.
Example Usage
resource "scalr_variable" "example1" {
key = "my_key_name"
value = "my_value_name"
category = "terraform"
description = "variable description"
workspace_id = "ws-xxxxxxxxxx"
}
resource "scalr_variable" "example2" {
key = "xyz"
value = jsonencode(["foo", "bar"])
hcl = true
category = "terraform"
workspace_id = "ws-yyyyyyyyyy"
}
# Using write-only value (Terraform 1.11+)
resource "scalr_variable" "example3" {
key = "secret_key"
value_wo = ephemeral.aws_secretsmanager_secret.my_secret.secret_string
value_wo_version = 1 # Increment to trigger an update when the secret changes
category = "terraform"
sensitive = true
workspace_id = "ws-zzzzzzzzzz"
}Schema
Required
category(String) Indicates if this is a Terraform or shell variable. Allowed values areterraformorshell.key(String) Key of the variable.
Optional
NOTE: Write-only arguments are supported in Terraform 1.11 and later.
account_id(String) ID of the account, in the formatacc-<RANDOM STRING>.description(String) Variable verbose description, defaults to empty string.environment_id(String) The environment that owns the variable, specified as an ID, in the formatenv-<RANDOM STRING>.final(Boolean) Set (true/false) to configure as final. Indicates whether the variable can be overridden on a lower scope down the Scalr organizational model. Defaultfalse.force(Boolean) Set (true/false) to configure as force. Allows creating final variables on higher scope, even if the same variable exists on lower scope (lower is to be deleted). Defaultfalse.hcl(Boolean) Set (true/false) to configure the variable as a string of HCL code. Has no effect forcategory = "shell"variables. Defaultfalse.sensitive(Boolean) Set (true/false) to configure as sensitive. Sensitive variable values are not visible after being set. Defaultfalse.value(String, Sensitive) Variable value.value_wo(String, Write-only) Write-only variable value. Use instead ofvaluewhen working with ephemeral values. Not stored in state. Requiresvalue_wo_versionto trigger updates.value_wo_version(Number) Version number forvalue_wo. Change this number to apply the currentvalue_woduring an update.workspace_id(String) The workspace that owns the variable, specified as an ID, in the formatws-<RANDOM STRING>.
Read-Only
id(String) The ID of this resource.readable_value(String) A non-sensitive read-only copy of a variable value. Will be null if the variable is sensitive.updated_at(String) Date/time the variable was updated.updated_by(List of Object) Details of the user that updated the variable last time. (see below for nested schema)updated_by_email(String) Email of the user who updated the variable last time.
Nested Schema for updated_by
updated_byRead-Only:
email(String)full_name(String)username(String)
Import
Import is supported using the following syntax:
terraform import scalr_variable.example var-xxxxxxxxxxUpdated about 1 month ago
