Skip to main content

State Management for Terraforms

Terraform state is the file that records which real resources correspond to your configuration, and it is how Terraform knows what to change. Local state is fine for learning, but teams use remote backends with locking, such as S3 with DynamoDB or similar services. State operations like import, mv and rm adjust that record carefully when resources are renamed or adopted.

Stage: State · Part of the Terraform roadmap · Last reviewed 19 November 2026

What to learn in State Management

State Management interview questions

Why should state not be stored in Git?

State can contain sensitive values such as passwords and keys in plain text, and it changes on every apply, so Git commits would conflict and expose secrets. A remote backend with encryption, access control and locking is the safer place for shared state.

What is state locking?

Locking prevents two people or pipelines from running Terraform against the same state at once, which could corrupt it. When a run starts, the backend takes a lock and releases it at the end. Backends such as S3 with DynamoDB or HCP Terraform provide locking.

Where State Management fits in the Terraform roadmap

State Management belongs to the State stage (intermediate level), which takes about 12 hours. Source of truth.

Back to the full Terraform roadmap