2014-07-24 18:02:10 +02:00
|
|
|
---
|
|
|
|
layout: "docs"
|
|
|
|
page_title: "Command: refresh"
|
|
|
|
sidebar_current: "docs-commands-refresh"
|
|
|
|
---
|
|
|
|
|
|
|
|
# Command: refresh
|
|
|
|
|
|
|
|
The `terraform refresh` command is used to reconcile the state Terraform
|
2014-07-28 22:09:32 +02:00
|
|
|
knows about (via its state file) with the real-world infrastructure.
|
2014-10-16 18:16:52 +02:00
|
|
|
This can be used to detect any drift from the last-known state, and to
|
2014-07-24 18:02:10 +02:00
|
|
|
update the state file.
|
|
|
|
|
|
|
|
This does not modify infrastructure, but does modify the state file.
|
|
|
|
If the state is changed, this may cause changes to occur during the next
|
|
|
|
plan or apply.
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
Usage: `terraform refresh [options] [dir]`
|
|
|
|
|
|
|
|
By default, `refresh` requires no flags and looks in the current directory
|
|
|
|
for the configuration and state file to refresh.
|
|
|
|
|
|
|
|
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-24 18:02:10 +02:00
|
|
|
* `-no-color` - Disables output with coloring
|
|
|
|
|
|
|
|
* `-state=path` - Path to read and write the state file to. 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.
|
|
|
|
|