github.com/vtorhonen/terraform@v0.9.0-beta2.0.20170307220345-5d894e4ffda7/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-or-plan]` 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 If the command is given an existing saved plan as an argument, the 25 command will output the contents of the saved plan. In this scenario, 26 the `plan` command will not modify the given plan. This can be used to 27 inspect a planfile. 28 29 The command-line flags are all optional. The list of available flags are: 30 31 * `-destroy` - If set, generates a plan to destroy all the known resources. 32 33 * `-detailed-exitcode` - Return a detailed exit code when the command exits. 34 When provided, this argument changes the exit codes and their meanings to 35 provide more granular information about what the resulting plan contains: 36 * 0 = Succeeded with empty diff (no changes) 37 * 1 = Error 38 * 2 = Succeeded with non-empty diff (changes present) 39 40 * `-input=true` - Ask for input for variables if not directly set. 41 42 * `-module-depth=n` - Specifies the depth of modules to show in the output. 43 This does not affect the plan itself, only the output shown. By default, 44 this is -1, which will expand all. 45 46 * `-no-color` - Disables output with coloring. 47 48 * `-out=path` - The path to save the generated execution plan. This plan 49 can then be used with `terraform apply` to be certain that only the 50 changes shown in this plan are applied. Read the warning on saved 51 plans below. 52 53 * `-parallelism=n` - Limit the number of concurrent operation as Terraform 54 [walks the graph](/docs/internals/graph.html#walking-the-graph). 55 56 * `-refresh=true` - Update the state prior to checking for differences. 57 58 * `-state=path` - Path to the state file. Defaults to "terraform.tfstate". 59 Ignored when [remote state](/docs/state/remote/index.html) is used. 60 61 * `-target=resource` - A [Resource 62 Address](/docs/internals/resource-addressing.html) to target. Operation will 63 be limited to this resource and its dependencies. This flag can be used 64 multiple times. 65 66 * `-var 'foo=bar'` - Set a variable in the Terraform configuration. This flag 67 can be set multiple times. Variable values are interpreted as 68 [HCL](/docs/configuration/syntax.html#HCL), so list and map values can be 69 specified via this flag. 70 71 * `-var-file=foo` - Set variables in the Terraform configuration from 72 a [variable file](/docs/configuration/variables.html#variable-files). If 73 "terraform.tfvars" is present, it will be automatically loaded first. Any 74 files specified by `-var-file` override any values in a "terraform.tfvars". 75 This flag can be used multiple times. 76 77 ## Security Warning 78 79 Saved plan files (with the `-out` flag) encode the configuration, 80 state, diff, and _variables_. Variables are often used to store secrets. 81 Therefore, the plan file can potentially store secrets. 82 83 Terraform itself does not encrypt the plan file. It is highly 84 recommended to encrypt the plan file if you intend to transfer it 85 or keep it at rest for an extended period of time. 86 87 Future versions of Terraform will make plan files more 88 secure.