| page_title | dbtcloud_environment_variable Resource - dbtcloud |
|---|---|
| subcategory | |
| description | Environment variable resource |
Note: Some upstream resources can be slow to create, so if creating a project or environment at
the same time as the environment variables, it's recommended to use the depends_on meta argument.
resource "dbtcloud_environment_variable" "dbt_my_env_var" {
name = "DBT_MY_ENV_VAR"
project_id = dbtcloud_project.dbt_project.id
environment_values = {
"project" : "my_project_level_value",
"Dev" : "my_env_level_value",
"CI" : "my_ci_override_value",
"Prod" : "my_prod_override_value"
}
depends_on = [
dbtcloud_project.dbt_project,
dbtcloud_environment.dev_env,
dbtcloud_environment.ci_env,
dbtcloud_environment.prod_env,
]
}environment_values(Map of String) Map from environment names to respective variable value, a special keyprojectshould be set for the project default variable value. This field is not set as sensitive so take precautions when using secret environment variables.name(String) Name for the variable, must be unique within a project, must be prefixed with 'DBT_'project_id(Number) Project ID to create the environment variable in
resource_metadata(Dynamic) Metadata for tracking resource identity during account migrations. Stored in Terraform state only and not sent to the API.
id(String) The ID of this resource. Contains the project ID and the environment variable ID.
Import is supported using the following syntax:
# using import blocks (requires Terraform >= 1.5)
import {
to = dbtcloud_environment_variable.test_environment_variable
id = "project_id:environment_variable_name"
}
import {
to = dbtcloud_environment_variable.test_environment_variable
id = "12345:DBT_ENV_VAR"
}
# using the older import command
terraform import dbtcloud_environment_variable.test_environment_variable "project_id:environment_variable_name"
terraform import dbtcloud_environment_variable.test_environment_variable 12345:DBT_ENV_VAR