Chapter 12: Terraform Introduction
12.3 State — local for learning, respect remote later
Local state — default terraform.tfstate on disk. OK for solo labs on your laptop.
Remote state (S3 + locking, Terraform Cloud, etc.) — team requirement later so two people do not apply at once and so state is backed up.
Warnings:
- State can contain sensitive attributes — treat it like a secret file.
- Never commit state to a public repo.
- Do not hand-edit state casually; use Terraform workflows (
import,state mv— advanced). - Deleting state without destroying resources leaves orphans in the cloud you must clean in console/CLI.
Ravindra Bagale's Tip
State file delete karun "clean start" — cloud resources ajun bill kartat. terraform destroy pahile, athava console madhe orphan clean. Dhyan rakho!