Command: refresh
Theterraform refresh command reads the current settings from all managed remote objects and updates the Terraform state to match.
Usage
This command is effectively an alias for
terraform apply -refresh-only -auto-approve. Use terraform apply -refresh-only for the non-deprecated workflow.Options
-
-compact-warnings- If Terraform produces any warnings that are not accompanied by errors, show them in a more compact form that includes only the summary messages. -
-input=true- Ask for input for variables if not directly set. -
-lock=false- Don’t hold a state lock during the operation. This is dangerous if others might concurrently run commands against the same workspace. -
-lock-timeout=DURATION- Duration to retry a state lock. Default is0s. -
-no-color- If specified, output won’t contain any color. -
-parallelism=n- Limit the number of concurrent operations. Defaults to 10. -
-target=resource- A Resource Address to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times. -
-var 'NAME=VALUE'- Set a value for one of the input variables in the root module of the configuration. Use this option multiple times to set more than one variable. -
-var-file=FILENAME- Set values for potentially many input variables declared in the root module of the configuration, using definitions from a “tfvars” file. Use this option multiple times to include values from more than one file.
terraform refresh also accepts the legacy options -state, -state-out, and -backup.
Alternative: apply -refresh-only
The recommended replacement forterraform refresh is: