Ravindra BagaleCourses & study guides

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:

  1. State can contain sensitive attributes — treat it like a secret file.
  2. Never commit state to a public repo.
  3. Do not hand-edit state casually; use Terraform workflows (import, state mv — advanced).
  4. 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!