Search⌘ K
AI Features

Terraform State

Explore how Terraform manages infrastructure state using the terraform.tfstate file. Understand the file's role, storage options, best practices like state locking and backups, and how workspaces help isolate environments. This lesson prepares you to maintain infrastructure state securely and effectively with Terraform.

Overview

Managing our Terraform infrastructure is possible because Terraform maintains the state of our infrastructure. The state is maintained in a file called a state file or the terraform.tfstate file. The state file contains the mapping of our infrastructure on our cloud platform to the configuration files we’ve defined.

Terraform state file
Terraform state file

Terraform state file format

The Terraform state file is written in JSON. One important thing to note is that it’s not recommended to modify a Terraform state file ...