open-vault/website/source/docs/commands/apply.html.markdown
2015-03-13 10:38:41 -07:00

2 KiB

layout page_title sidebar_current description
docs Command: apply docs-commands-apply The `vault 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 `vault plan` execution plan.

Command: apply

The vault 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 vault plan execution plan.

Usage

Usage: vault 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 dir argument can also be a module source. In this case, apply behaves as though init were called with that argument followed by an apply in the current directory. This is meant as a shortcut for getting started.

The command-line flags are all optional. The list of available flags are:

  • -backup=path - Path to the backup file. Defaults to -state-out with the ".backup" extension. Disabled by setting to "-".

  • -input=true - Ask for input for variables if not directly set.

  • -no-color - Disables output with coloring.

  • -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.

  • -state=path - Path to the state file. Defaults to "vault.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 Vault configuration. This flag can be set multiple times.

  • -var-file=foo - Set variables in the Vault configuration from a file. If "vault.tfvars" is present, it will be automatically loaded if this flag is not specified.