From 0a90b854187669a4e2fdb723ca1912024e8ad2ad Mon Sep 17 00:00:00 2001 From: Aurelie Vache Date: Thu, 17 Jan 2019 15:24:16 +0100 Subject: [PATCH] feat(environment variable): add TF_WORKSPACE information --- .../docs/commands/environment-variables.html.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/website/docs/commands/environment-variables.html.md b/website/docs/commands/environment-variables.html.md index 50098a6cb..8e3175326 100644 --- a/website/docs/commands/environment-variables.html.md +++ b/website/docs/commands/environment-variables.html.md @@ -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 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).