github.com/turtlemonvh/terraform@v0.6.9-0.20151204001754-8e40b6b855e8/website/source/docs/commands/refresh.html.markdown (about) 1 --- 2 layout: "docs" 3 page_title: "Command: refresh" 4 sidebar_current: "docs-commands-refresh" 5 description: |- 6 The `terraform refresh` command is used to reconcile the state Terraform knows about (via its state file) with the real-world infrastructure. This can be used to detect any drift from the last-known state, and to update the state file. 7 --- 8 9 # Command: refresh 10 11 The `terraform refresh` command is used to reconcile the state Terraform 12 knows about (via its state file) with the real-world infrastructure. 13 This can be used to detect any drift from the last-known state, and to 14 update the state file. 15 16 This does not modify infrastructure, but does modify the state file. 17 If the state is changed, this may cause changes to occur during the next 18 plan or apply. 19 20 ## Usage 21 22 Usage: `terraform refresh [options] [dir]` 23 24 By default, `refresh` requires no flags and looks in the current directory 25 for the configuration and state file to refresh. 26 27 The command-line flags are all optional. The list of available flags are: 28 29 * `-backup=path` - Path to the backup file. Defaults to `-state-out` with 30 the ".backup" extension. Disabled by setting to "-". 31 32 * `-no-color` - Disables output with coloring 33 34 * `-state=path` - Path to read and write the state file to. Defaults to "terraform.tfstate". 35 36 * `-state-out=path` - Path to write updated state file. By default, the 37 `-state` path will be used. 38 39 * `-target=resource` - A [Resource 40 Address](/docs/internals/resource-addressing.html) to target. Operation will 41 be limited to this resource and its dependencies. This flag can be used 42 multiple times. 43 44 * `-var 'foo=bar'` - Set a variable in the Terraform configuration. This 45 flag can be set multiple times. 46 47 * `-var-file=foo` - Set variables in the Terraform configuration from 48 a file. If "terraform.tfvars" is present, it will be automatically 49 loaded if this flag is not specified. 50