Terraform upgrade. Apply with -refresh-only option

Hi terraform experts,

We are trying to upgrade our terraform version from 0.12 to 1.4 and we have 2 pain points:

  1. We have thousands of terraform configurations. Any small time saving will be a huge gain for us.
  2. Some of our own providers show changes in terraform plan every time even if you didn’t change anything in terraform config. It’s hard to guarantee 0 changes in TF apply which is the best practice according to upgrade guide.

After research, we have a plan:
We divided our upgrade path into 2 phases. And we have some questions regarding each phase:

Phase 1. upgrade from 0.12 → 0.13
In this phase, looks like -refresh-only option is not available. So we tried

terraform apply target="some fake address"  

After running this command, we can see that all provider address has been updated however the updated address is wrong. Is there anything similar to -refresh-only option in terraform v0.13?

Phase 2. upgrade from 0.13 → 1.4
In this phase, we are running this command:

terraform apply -refresh-only

We did a test and it worked for us at least in happy path. Do you have any concern on this command? (We don’t see refresh-only mentioned in upgrade doc so we want to make sure this command won’t cause any issue)

Hi @tzyhuster,

The terraform refresh command is an older command that terraform apply -refresh-only has replaced.

You should be able to use that command with Terraform v0.13, but be careful because unlike terraform apply the refresh command has no confirmation prompt: it will immediately update the state to match what the providers returned during refreshing.

(The possibility of a confirmation prompt is the benefit that terraform apply -refresh-only adds, and why that option has replaced terraform refresh in newer versions of Terraform.)