Merge pull request #20036 from scraly/patch-2

feat(environment variable): add TF_WORKSPACE information
This commit is contained in:
Pam Selle 2020-10-13 16:11:09 -04:00 committed by GitHub
commit 98603a7c51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 0 deletions

View File

@ -101,6 +101,21 @@ to the next, so it's important to have this variable set consistently throughout
all of the Terraform workflow commands (starting with `terraform init`) or else
Terraform may be unable to find providers, modules, and other artifacts.
## TF_WORKSPACE
For multi-environment deployment, in order to select a workspace, instead of doing `terraform workspace select your_workspace`, it is possible to use this environment variable. Using TF_WORKSPACE allow and override workspace selection.
For example:
```shell
export TF_WORKSPACE=your_workspace
```
Using this environment variable is recommended only for non-interactive usage, since in a local shell environment it can be easy to forget the variable is set and apply changes to the wrong state.
For more information regarding workspaces, check out the section on [Using Workspaces]
(https://www.terraform.io/docs/state/workspaces.html).
## TF_IN_AUTOMATION
If `TF_IN_AUTOMATION` is set to any non-empty value, Terraform adjusts its