github.com/ns1/terraform@v0.7.10-0.20161109153551-8949419bef40/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 Ignored when [remote state](/docs/state/remote/index.html) is used. 36 37 * `-state-out=path` - Path to write updated state file. By default, the 38 `-state` path will be used. Ignored when 39 [remote state](/docs/state/remote/index.html) is used. 40 41 * `-target=resource` - A [Resource 42 Address](/docs/internals/resource-addressing.html) to target. Operation will 43 be limited to this resource and its dependencies. This flag can be used 44 multiple times. 45 46 * `-var 'foo=bar'` - Set a variable in the Terraform configuration. This flag 47 can be set multiple times. Variable values are interpreted as 48 [HCL](/docs/configuration/syntax.html#HCL), so list and map values can be 49 specified via this flag. 50 51 * `-var-file=foo` - Set variables in the Terraform configuration from 52 a [variable file](/docs/configuration/variables.html#variable-files). If 53 "terraform.tfvars" is present, it will be automatically loaded first. Any 54 files specified by `-var-file` override any values in a "terraform.tfvars". 55 This flag can be used multiple times.