Interview Prep/Terraform/State Internals

How does refresh work and what is the effect of `-refresh=false`?

AdvancedConceptState Internals
Answer

During plan or apply Terraform calls each provider's read to update state attributes from reality before diffing. -refresh=false skips this and trusts state, which speeds large plans but hides drift and can produce a plan that fails at apply because reality moved. We use it only for fast iterations in dev, never for the authoritative plan.

All Terraform questions Roadmap: Terraform in production

More on State Internals