Interview Prep/Terraform/State Backends and Workspaces

How do you inspect what Terraform thinks it manages?

BeginnerScenarioState Backends and Workspaces
Answer

Situation read → You want to see what's in state.

What I'd do →

terraform state list
terraform state show aws_instance.web
terraform show -json | jq '.values.root_module.resources[].address'
terraform state pull > snapshot.json

Why → state list gives addresses, state show gives attributes, and pull writes the raw JSON for offline inspection.

Interview tip → State is JSON but never edit it by hand; use state mv, rm or import.

All Terraform questions Roadmap: Terraform in production

More on State Backends and Workspaces