Environment variables are injected into the virtual environment that Terraform
executes in during the `plan` and `apply` phases.
@ -75,9 +90,47 @@ For any of the `GITHUB_` attributes, the value of the environment variable will
be the empty string (`""`) if the resource is not connected to GitHub or if the
resource was created outside of GitHub (like using `terraform push`).
### Personal Environment and Personal Organization Variables
Personal variables can be created at the Environment or Organization level and
are private and scoped to the user that created them. Personal Environment
variables are scoped to just the environment they are attached to, while Personal
Organization variables are applied across any environment a user triggers a
Terraform run in. Just like shared Environment variables, they are injected into
the virtual environment during the `plan` and `apply` phases.
Both Personal Environment and Personal Organization variables can be used to
override Environment variables on a per-user basis.
## Variable Hierarchy
It is possible to create the same variable in multiple places for more granular
control. Variables are applied in the following order from least to most
precedence:
1. Environment
2. Personal Organization
3. Personal Environment
Here's an example:
* For the `SlothCorp/petting_zoo` environment, User 1 creates
an Environment variable called `SECRET_GATE_ACCESS_KEY` and sets the value to
`"orange-turtleneck"`
* User 2 adds a Personal Environment variable for
`SECRET_GATE_ACCESS_KEY` and sets the value to `"pink-overalls"`
* When User 2 submits a `plan` or `apply`, the `SECRET_GATE_ACCESS_KEY`
will use `"pink-overalls"`
* When User 1, or any other user, submits a `plan` or `apply`, the
`SECRET_GATE_ACCESS_KEY` will use `"orange-turtleneck"`
## Managing Secret Multi-Line Files
Terraform Enterprise has the ability to store multi-line files as variables. The recommended way to manage your secret/sensitive multi-line files (private key, SSL cert, SSL private key, CA, etc.) is to add them as [Terraform Variables](#terraform-variables) or [Environment Variables](#environment-variables).
Terraform Enterprise has the ability to store multi-line files as variables. The
recommended way to manage your secret or sensitive multi-line files (private key,
SSL cert, SSL private key, CA, etc.) is to add them as
[Terraform Variables](#terraform-variables) or
[Environment Variables](#environment-variables).
Just like secret strings, it is recommended that you never check in these
multi-line secret files to version control by following the below steps.