Terraform state: drift, locking and recovery
Three observations
A fictional server is configured with size 2. State last recorded size 2. An authorized operator changes the provider object to size 4 outside Terraform. The configuration and the provider now disagree; the saved state can also be stale.
A normal plan refreshes its view and can propose restoring size 2. A refresh-only operation instead records observed values without changing the provider. Neither operation decides whether the external change was approved as the new desired configuration.
Locking and secrets
A supported backend lock coordinates state writers. A lock is evidence to investigate, not permission to remove protection from an active operation. Confirm the owner and whether its operation is still running before following the organization’s recovery procedure.
State can contain secrets. Marking an output sensitive redacts ordinary display; it does not remove the value from state. Protect state and plan artifacts through access controls. Ephemeral values and write-only arguments have separate version and provider support requirements.
Read the official state reference and sensitive-data guidance. Practice state commands and import before a recovery task. The course models backends locally and cannot prove a hosted backend’s permissions, encryption or concurrent-write behavior.