A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.hashicorp.com/terraform/cli/commands/refresh below:

terraform refresh command reference | Terraform

terraform refresh command

The terraform refresh command reads the current settings from all managed remote objects and updates the Terraform state to match. This command is deprecated. Instead, add the -refresh-only flag to terraform apply and terraform plan commands.

This does not modify your real remote objects, but it modifies the Terraform state.

Hands-on: Try the Use Refresh-Only Mode to Sync Terraform State tutorial.

Usage: terraform refresh [options]

This command is effectively an alias for the following command:

terraform apply -refresh-only -auto-approve

Consequently, it supports all of the same options as terraform apply except that it does not accept a saved plan file, it doesn't allow selecting a planning mode other than "refresh only", and -auto-approve is always enabled.

Automatically applying the effect of a refresh is risky. If you have misconfigured credentials for one or more providers, Terraform may be misled into thinking that all of the managed objects have been deleted, causing it to remove all of the tracked objects without any confirmation prompt.

Instead, we recommend using the following command in order to get the same effect but with the opportunity to review the changes that Terraform has detected before committing them to the state:

terraform apply -refresh-only

This alternative command will present an interactive prompt for you to confirm the detected changes.

The -refresh-only option for terraform plan and terraform apply was introduced in Terraform v0.15.4. For prior versions you must use terraform refresh directly if you need this behavior, while taking into account the warnings above. Wherever possible, avoid using terraform refresh explicitly and instead rely on Terraform's behavior of automatically refreshing existing objects as part of creating a normal plan.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4