github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/website/source/docs/commands/env/new.html.md (about) 1 --- 2 layout: "commands-env" 3 page_title: "Command: env new" 4 sidebar_current: "docs-env-sub-new" 5 description: |- 6 The terraform env new command is used to create a new state environment. 7 --- 8 9 # Command: env new 10 11 The `terraform env new` command is used to create a new state 12 environment. 13 14 ## Usage 15 16 Usage: `terraform env new [NAME]` 17 18 This command will create a new environment with the given name. This 19 environment must not already exist. 20 21 If the `-state` flag is given, the state specified by the given path 22 will be copied to initialize the state for this new environment. 23 24 The command-line flags are all optional. The list of available flags are: 25 26 * `-state=path` - Path to a state file to initialize the state of this environment. 27 28 ## Example: Create 29 30 ``` 31 $ terraform env new example 32 Created and switched to environment "example"! 33 34 You're now on a new, empty environment. Environments isolate their state, 35 so if you run "terraform plan" Terraform will not see any existing state 36 for this configuration. 37 ``` 38 39 ## Example: Create from State 40 41 To create a new environment from a pre-existing state path: 42 43 ``` 44 $ terraform env new -state=old.terraform.tfstate example 45 Created and switched to environment "example"! 46 47 You're now on a new, empty environment. Environments isolate their state, 48 so if you run "terraform plan" Terraform will not see any existing state 49 for this configuration. 50 ```