From 0a90b854187669a4e2fdb723ca1912024e8ad2ad Mon Sep 17 00:00:00 2001 From: Aurelie Vache Date: Thu, 17 Jan 2019 15:24:16 +0100 Subject: [PATCH 1/2] 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). From 2f0a46d75c4bc44f8fe3bab1ab217c0614f915fe Mon Sep 17 00:00:00 2001 From: Aurelie Vache Date: Fri, 18 Jan 2019 16:26:42 +0100 Subject: [PATCH 2/2] fix: TF_WORKSPACE export cmd --- website/docs/commands/environment-variables.html.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/commands/environment-variables.html.md b/website/docs/commands/environment-variables.html.md index 8e3175326..befecaec9 100644 --- a/website/docs/commands/environment-variables.html.md +++ b/website/docs/commands/environment-variables.html.md @@ -108,7 +108,7 @@ For multi-environment deployment, in order to select a workspace, instead of doi For example: ```shell -export TF_WORKSPACE your_workspace +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.