Command: workspace select
The tofu workspace select command is used to choose a different workspace to use for further operations.
Usage
Usage: tofu workspace select NAME [DIR]
This command will select another workspace. The named workspace must already exist.
Use of variables in module sources, backend configuration, or encryption block requires assigning values to root module variables when running tofu workspace select.
The supported flags are:
-
-or-create- If the workspace that is being selected does not exist, create it. Default isfalse. -
-var 'NAME=VALUE'- Sets a value for a single input variable declared in the root module of the configuration. Use this option multiple times to set more than one variable. Refer to Input Variables on the Command Line for more information. -
-var-file=FILENAME- Sets values for potentially many input variables declared in the root module of the configuration, using definitions from a "tfvars" file. Use this option multiple times to include values from more than one file.
There are several other ways to set values for input variables in the root module, aside from the -var and -var-file options. Refer to Assigning Values to Root Module Variables for more information.
Example
$ tofu workspace list default * development jsmith-test $ tofu workspace select default Switched to workspace "default".
Copyright (c) The OpenTofu Authors
Copyright (c) 2014 HashiCorp, Inc.
Mozilla Public License, version 2.0
https://opentofu.org/docs/v1.10/cli/commands/workspace/select/