Kinds of terraform files

  • state files (terraform.tfstate)
  • configs (.tf)
  • plans (.tfplan)
  • variables file (.tfvars)


After a terraform apply, Terraform refreshes the local terraform.tfstate file.

terraform plan refreshes local state first, but only in-memory.

terraform state list

A brief list of all objects in the current state.

terraform state list

Get state details

There are two ways:

  • terraform show
  • terraform state show

terraform state show is a lot more brief, and doesn't have the option to show JSON output.

terraform show -json dumps everything, and then you can dig into it with jq.


A workspace has

  • Terraform config (HCL files)
  • Values for variables used by the config
  • Terraform state
  • Historical state and run logs