github.com/turtlemonvh/terraform@v0.6.9-0.20151204001754-8e40b6b855e8/website/source/docs/commands/plan.html.markdown (about) 1 --- 2 layout: "docs" 3 page_title: "Command: plan" 4 sidebar_current: "docs-commands-plan" 5 description: |- 6 The `terraform plan` command is used to create an execution plan. Terraform performs a refresh, unless explicitly disabled, and then determines what actions are necessary to achieve the desired state specified in the configuration files. The plan can be saved using `-out`, and then provided to `terraform apply` to ensure only the pre-planned actions are executed. 7 --- 8 9 # Command: plan 10 11 The `terraform plan` command is used to create an execution plan. Terraform 12 performs a refresh, unless explicitly disabled, and then determines what 13 actions are necessary to achieve the desired state specified in the 14 configuration files. The plan can be saved using `-out`, and then provided 15 to `terraform apply` to ensure only the pre-planned actions are executed. 16 17 ## Usage 18 19 Usage: `terraform plan [options] [dir]` 20 21 By default, `plan` requires no flags and looks in the current directory 22 for the configuration and state file to refresh. 23 24 The command-line flags are all optional. The list of available flags are: 25 26 * `-backup=path` - Path to the backup file. Defaults to `-state-out` with 27 the ".backup" extension. Disabled by setting to "-". 28 29 * `-destroy` - If set, generates a plan to destroy all the known resources. 30 31 * `-detailed-exitcode` - Return a detailed exit code when the command exits. 32 When provided, this argument changes the exit codes and their meanings to 33 provide more granular information about what the resulting plan contains: 34 * 0 = Succeeded with empty diff (no changes) 35 * 1 = Error 36 * 2 = Succeeded with non-empty diff (changes present) 37 38 * `-input=true` - Ask for input for variables if not directly set. 39 40 * `-module-depth=n` - Specifies the depth of modules to show in the output. 41 This does not affect the plan itself, only the output shown. By default, 42 this is zero. -1 will expand all. 43 44 * `-no-color` - Disables output with coloring. 45 46 * `-out=path` - The path to save the generated execution plan. This plan 47 can then be used with `terraform apply` to be certain that only the 48 changes shown in this plan are applied. Read the warning on saved 49 plans below. 50 51 * `-parallelism=n` - Limit the number of concurrent operation as Terraform 52 [walks the graph](/docs/internals/graph.html#walking-the-graph). 53 54 * `-refresh=true` - Update the state prior to checking for differences. 55 56 * `-state=path` - Path to the state file. Defaults to "terraform.tfstate". 57 58 * `-target=resource` - A [Resource 59 Address](/docs/internals/resource-addressing.html) to target. Operation will 60 be limited to this resource and its dependencies. This flag can be used 61 multiple times. 62 63 * `-var 'foo=bar'` - Set a variable in the Terraform configuration. This 64 flag can be set multiple times. 65 66 * `-var-file=foo` - Set variables in the Terraform configuration from 67 a file. If "terraform.tfvars" is present, it will be automatically 68 loaded if this flag is not specified. 69 70 ## Security Warning 71 72 Saved plan files (with the `-out` flag) encode the configuration, 73 state, diff, and _variables_. Variables are often used to store secrets. 74 Therefore, the plan file can potentially store secrets. 75 76 Terraform itself does not encrypt the plan file. It is highly 77 recommended to encrypt the plan file if you intend to transfer it 78 or keep it at rest for an extended period of time. 79 80 Future versions of Terraform will make plan files more 81 secure.