github.com/wikibal01/hashicorp-terraform@v0.11.12-beta1/website/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. Explicit execution plans files can be
    22  used to split plan and apply into separate steps within
    23  [automation systems](/guides/running-terraform-in-automation.html).
    24  
    25  The command-line flags are all optional. The list of available flags are:
    26  
    27  * `-backup=path` - Path to the backup file. Defaults to `-state-out` with
    28    the ".backup" extension. Disabled by setting to "-".
    29  
    30  * `-lock=true` - Lock the state file when locking is supported.
    31  
    32  * `-lock-timeout=0s` - Duration to retry a state lock.
    33  
    34  * `-input=true` - Ask for input for variables if not directly set.
    35  
    36  * `-auto-approve` - Skip interactive approval of plan before applying.
    37  
    38  * `-no-color` - Disables output with coloring.
    39  
    40  * `-parallelism=n` - Limit the number of concurrent operation as Terraform
    41    [walks the graph](/docs/internals/graph.html#walking-the-graph).
    42  
    43  * `-refresh=true` - Update the state for each resource prior to planning
    44    and applying. This has no effect if a plan file is given directly to
    45    apply.
    46  
    47  * `-state=path` - Path to the state file. Defaults to "terraform.tfstate".
    48    Ignored when [remote state](/docs/state/remote.html) is used.
    49  
    50  * `-state-out=path` - Path to write updated state file. By default, the
    51    `-state` path will be used. Ignored when
    52    [remote state](/docs/state/remote.html) is used.
    53  
    54  * `-target=resource` - A [Resource
    55    Address](/docs/internals/resource-addressing.html) to target. For more
    56    information, see
    57    [the targeting docs from `terraform plan`](/docs/commands/plan.html#resource-targeting).
    58  
    59  * `-var 'foo=bar'` - Set a variable in the Terraform configuration. This flag
    60    can be set multiple times. Variable values are interpreted as
    61    [HCL](/docs/configuration/syntax.html#HCL), so list and map values can be
    62    specified via this flag.
    63  
    64  * `-var-file=foo` - Set variables in the Terraform configuration from
    65    a [variable file](/docs/configuration/variables.html#variable-files). If
    66    a `terraform.tfvars` or any `.auto.tfvars` files are present in the current
    67    directory, they will be automatically loaded. `terraform.tfvars` is loaded
    68    first and the `.auto.tfvars` files after in alphabetical order. Any files
    69    specified by `-var-file` override any values set automatically from files in
    70    the working directory. This flag can be used multiple times.