2014-07-25 00:53:46 +02:00
|
|
|
---
|
|
|
|
layout: "docs"
|
|
|
|
page_title: "Command: apply"
|
|
|
|
sidebar_current: "docs-commands-apply"
|
|
|
|
---
|
|
|
|
|
|
|
|
# Command: apply
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
Usage: `terraform apply [options] [dir]`
|
|
|
|
|
|
|
|
By default, `apply` scans the current directory for the configuration
|
|
|
|
and applies the changes appropriately. However, a path to another configuration
|
|
|
|
or an execution plan can be provided. Execution plans can be used to only
|
|
|
|
execute a pre-determined set of actions.
|
|
|
|
|
|
|
|
The command-line flags are all optional. The list of available flags are:
|
|
|
|
|
2014-07-28 05:40:18 +02:00
|
|
|
* `-backup=path` - Path to the backup file. Defaults to `-state-out` with
|
2014-08-07 09:19:56 +02:00
|
|
|
the ".backup" extension. Disabled by setting to "-".
|
2014-07-28 05:40:18 +02:00
|
|
|
|
2014-07-25 00:53:46 +02:00
|
|
|
* `-no-color` - Disables output with coloring.
|
|
|
|
|
2014-07-27 02:50:53 +02:00
|
|
|
* `-refresh=true` - Update the state for each resource prior to planning
|
|
|
|
and applying. This has no effect if a plan file is given directly to
|
|
|
|
apply.
|
|
|
|
|
2014-07-25 00:53:46 +02:00
|
|
|
* `-state=path` - Path to the state file. Defaults to "terraform.tfstate".
|
|
|
|
|
|
|
|
* `-state-out=path` - Path to write updated state file. By default, the
|
|
|
|
`-state` path will be used.
|
|
|
|
|
|
|
|
* `-var 'foo=bar'` - Set a variable in the Terraform configuration. This
|
|
|
|
flag can be set multiple times.
|
|
|
|
|
|
|
|
* `-var-file=foo` - Set variables in the Terraform configuration from
|
|
|
|
a file. If "terraform.tfvars" is present, it will be automatically
|
|
|
|
loaded if this flag is not specified.
|
|
|
|
|