feat(environment variable): add TF_WORKSPACE information

This commit is contained in:
Aurelie Vache 2019-01-17 15:24:16 +01:00 committed by GitHub
parent 2ad9f0513a
commit 0a90b85418
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 0 deletions

View File

@ -100,3 +100,18 @@ The data directory is used to retain data that must persist from one command
to the next, so it's important to have this variable set consistently throughout 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 all of the Terraform workflow commands (starting with `terraform init`) or else
Terraform may be unable to find providers, modules, and other artifacts. 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).