Terraform backend

The setting that decides where Terraform stores state and how it locks it, from a local file to shared cloud storage.

In more detail

The default local backend keeps terraform.tfstate on your disk, which is fine alone but gives a team no sharing, locking or recovery. Remote backends such as s3 store state in shared, access-controlled, versioned storage. Changing the backend requires terraform init again, with -migrate-state or -reconfigure.

Example

terraform {
  backend "local" {
    path = "terraform.tfstate"
  }
}

Related terms

Related guides

Taught in

References

Certification courses