Configure remote state with the backend block
Unlock the complete study guide + 1,040 practice questions across 16 full exams.
Bundled into the existing HashiCorp Certified: Terraform Associate premium course — no separate purchase.
14-day money-back guarantee — no questions asked.
Included in this chapter:
- Where Terraform state lives
- Choosing a backend type
- Partial configuration: settings at init
- The cloud block and re-initializing
- Exam-pattern recognition
Three ways to store Terraform state
| Aspect | Default local | backend block | cloud block |
|---|---|---|---|
| How it is declared | No block; the implicit default | backend "TYPE" in the terraform block | cloud block in the terraform block |
| Where state is stored | Local terraform.tfstate file | The chosen remote store (S3, GCS, azurerm, ...) | HCP Terraform or Terraform Enterprise |
| State locking | None across machines | Yes, on backends that support it | Yes, plus queued runs |
| Can reference variables | n/a | No; literals or -backend-config | No; literals only |
| Change requires terraform init | n/a | Yes; migrate or reconfigure | Yes; migrate or reconfigure |
| Mutually exclusive with | n/a | A cloud block | A backend block |
Decision tree
Cheat sheet
Unlock with Premium — includes all practice exams and the complete study guide.