Skill 6.4.1
Detecting drift with refresh-only mode
Key Concepts
Drift occurs when someone changes a managed object outside Terraform, such as editing a security group in the console. Every normal plan refreshes state first, so drift appears as changes Terraform proposes to revert. terraform plan -refresh-only instead shows only what has changed outside Terraform, and terraform apply -refresh-only updates the state to match reality without changing any infrastructure.
Refresh-only mode replaces the deprecated terraform refresh command, which updated state without showing changes first. Refresh-only apply also updates root module outputs that depend on the refreshed values.