github.com/meteor/terraform@v0.6.15-0.20210412225145-79ec4bc057c6/website/source/docs/commands/apply.html.markdown (about) 1 --- 2 layout: "docs" 3 page_title: "Command: apply" 4 sidebar_current: "docs-commands-apply" 5 description: |- 6 The `terraform apply` command is used to apply the changes required to reach the desired state of the configuration, or the pre-determined set of actions generated by a `terraform plan` execution plan. 7 --- 8 9 # Command: apply 10 11 The `terraform apply` command is used to apply the changes required 12 to reach the desired state of the configuration, or the pre-determined 13 set of actions generated by a `terraform plan` execution plan. 14 15 ## Usage 16 17 Usage: `terraform apply [options] [dir-or-plan]` 18 19 By default, `apply` scans the current directory for the configuration 20 and applies the changes appropriately. However, a path to another configuration 21 or an execution plan can be provided. Execution plans can be used to only 22 execute a pre-determined set of actions. 23 24 The `dir` argument can also be a [module source](/docs/modules/index.html). 25 In this case, `apply` behaves as though `init` were called with that 26 argument followed by an `apply` in the current directory. This is meant 27 as a shortcut for getting started. 28 29 The command-line flags are all optional. The list of available flags are: 30 31 * `-backup=path` - Path to the backup file. Defaults to `-state-out` with 32 the ".backup" extension. Disabled by setting to "-". 33 34 * `-lock=true` - Lock the state file when locking is supported. 35 36 * `-lock-timeout=0s` - Duration to retry a state lock. 37 38 * `-input=true` - Ask for input for variables if not directly set. 39 40 * `-confirm-plan` - Display the plan and ask for confirmation before applying. 41 42 * `-no-color` - Disables output with coloring. 43 44 * `-parallelism=n` - Limit the number of concurrent operation as Terraform 45 [walks the graph](/docs/internals/graph.html#walking-the-graph). 46 47 * `-refresh=true` - Update the state for each resource prior to planning 48 and applying. This has no effect if a plan file is given directly to 49 apply. 50 51 * `-state=path` - Path to the state file. Defaults to "terraform.tfstate". 52 Ignored when [remote state](/docs/state/remote.html) is used. 53 54 * `-state-out=path` - Path to write updated state file. By default, the 55 `-state` path will be used. Ignored when 56 [remote state](/docs/state/remote.html) is used. 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 flag 64 can be set multiple times. Variable values are interpreted as 65 [HCL](/docs/configuration/syntax.html#HCL), so list and map values can be 66 specified via this flag. 67 68 * `-var-file=foo` - Set variables in the Terraform configuration from 69 a [variable file](/docs/configuration/variables.html#variable-files). If 70 "terraform.tfvars" is present, it will be automatically loaded first. Any 71 files specified by `-var-file` override any values in a "terraform.tfvars". 72 This flag can be used multiple times.