Describe the Default Local Back-end

Learn where and how Terraform stores its state data.

What is a backend?

Terraform needs a location to store its state data, which is called a back-end. In the absence of an alternate configuration, it stores the state on the local filesystem where the configuration is stored. Let’s examine the typical folder structure for an example configuration:

.
├── .terraform
├── main.tf
└── terraform.tfstate

This Terraform configuration has been initialized and run through terraform plan and terraform apply. As a result, the .terraform directory holds the plugins used by the configuration, and the terraform.tfstate file holds the state data about the configuration.

The location of the local state file can be altered using the command line flag -state=statefile for commands like terraform plan and terraform apply.

Get hands-on with 1400+ tech skills courses.