github.com/muratcelep/terraform@v1.1.0-beta2-not-internal-4/website/docs/cli/commands/workspace/new.html.md (about) 1 --- 2 layout: "docs" 3 page_title: "Command: workspace new" 4 sidebar_current: "docs-commands-workspace-sub-new" 5 description: |- 6 The terraform workspace new command is used to create a new workspace. 7 --- 8 9 # Command: workspace new 10 11 The `terraform workspace new` command is used to create a new workspace. 12 13 ## Usage 14 15 Usage: `terraform workspace new [OPTIONS] NAME [DIR]` 16 17 This command will create a new workspace with the given name. A workspace with 18 this name must not already exist. 19 20 If the `-state` flag is given, the state specified by the given path 21 will be copied to initialize the state for this new workspace. 22 23 The command-line flags are all optional. The supported flags are: 24 25 * `-lock=false` - Don't hold a state lock during the operation. This is 26 dangerous if others might concurrently run commands against the same 27 workspace. 28 * `-lock-timeout=DURATION` - Duration to retry a state lock. Default 0s. 29 * `-state=path` - Path to an existing state file to initialize the state of this environment. 30 31 ## Example: Create 32 33 ``` 34 $ terraform workspace new example 35 Created and switched to workspace "example"! 36 37 You're now on a new, empty workspace. Workspaces isolate their state, 38 so if you run "terraform plan" Terraform will not see any existing state 39 for this configuration. 40 ``` 41 42 ## Example: Create from State 43 44 To create a new workspace from a pre-existing local state file: 45 46 ``` 47 $ terraform workspace new -state=old.terraform.tfstate example 48 Created and switched to workspace "example". 49 50 You're now on a new, empty workspace. Workspaces isolate their state, 51 so if you run "terraform plan" Terraform will not see any existing state 52 for this configuration. 53 ```