2020-10-27 02:15:36 +01:00
|
|
|
---
|
2021-11-23 00:57:25 +01:00
|
|
|
layout: "language"
|
|
|
|
page_title: "Backend Overview - Configuration Language"
|
2021-12-07 22:07:22 +01:00
|
|
|
description: "A backend defines where Terraform stores its state. Learn about how backends work."
|
2020-10-27 02:15:36 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
# Backends
|
|
|
|
|
2021-12-07 22:07:22 +01:00
|
|
|
Backends define where Terraform's [state](/docs/language/state/index.html) snapshots are stored.
|
|
|
|
|
|
|
|
A given Terraform configuration can either specify a backend,
|
|
|
|
[integrate with Terraform Cloud](/docs/language/settings/terraform-cloud.html),
|
|
|
|
or do neither and default to storing state locally.
|
2020-10-27 02:15:36 +01:00
|
|
|
|
|
|
|
The rest of this page introduces the concept of backends; the other pages in
|
|
|
|
this section document how to configure and use backends.
|
|
|
|
|
2021-11-23 00:57:25 +01:00
|
|
|
- [Backend Configuration](/docs/language/settings/backends/configuration.html) documents the form
|
2020-10-27 02:15:36 +01:00
|
|
|
of a `backend` block, which selects and configures a backend for a
|
|
|
|
Terraform configuration.
|
|
|
|
- This section also includes a page for each of Terraform's built-in backends,
|
|
|
|
documenting its behavior and available settings. See the navigation sidebar
|
|
|
|
for a complete list.
|
|
|
|
|
|
|
|
## What Backends Do
|
|
|
|
|
2021-12-07 22:07:22 +01:00
|
|
|
Backends primarily determine where Terraform stores its [state](/docs/language/state/index.html).
|
|
|
|
Terraform uses this persisted [state](/docs/language/state/index.html) data to keep track of the
|
|
|
|
resources it manages. Since it needs the state in order to know which real-world infrastructure
|
|
|
|
objects correspond to the resources in a configuration, everyone working with a given collection of
|
|
|
|
infrastructure resources must be able to access the same state data.
|
2020-10-27 02:15:36 +01:00
|
|
|
|
2021-12-07 22:07:22 +01:00
|
|
|
By default, Terraform implicitly uses a backend called
|
|
|
|
[`local`](/docs/language/settings/backends/local.html) to store state as a local file on disk.
|
|
|
|
Every other backend stores state in a remote service of some kind, which allows multiple people to
|
|
|
|
access it. Accessing state in a remote service generally requires some kind of access credentials,
|
|
|
|
since state data contains extremely sensitive information.
|
2020-10-27 02:15:36 +01:00
|
|
|
|
|
|
|
Some backends act like plain "remote disks" for state files; others support
|
|
|
|
_locking_ the state while operations are being performed, which helps prevent
|
|
|
|
conflicts and inconsistencies.
|
|
|
|
|
2021-12-08 19:55:45 +01:00
|
|
|
-> **Note:** In Terraform versions prior to 1.1.0, backends were also classified as being 'standard'
|
2021-12-07 22:07:22 +01:00
|
|
|
or 'enhanced', where the latter term referred to the ability of the
|
2021-12-09 00:03:26 +01:00
|
|
|
[remote backend](/docs/language/settings/backends/remote.html) to store state and perform
|
2021-12-07 22:07:22 +01:00
|
|
|
Terraform operations. This classification has been removed, clarifying the primary purpose of
|
2021-12-09 00:01:48 +01:00
|
|
|
backends. Refer to [Using Terraform Cloud](/docs/cli/cloud/index.html) for details about how to
|
2021-12-07 22:07:22 +01:00
|
|
|
store state, execute remote operations, and use Terraform Cloud directly from Terraform.
|
2020-10-27 02:15:36 +01:00
|
|
|
|
2021-12-07 22:07:22 +01:00
|
|
|
## Available Backends
|
2020-10-27 02:15:36 +01:00
|
|
|
|
2021-12-07 22:07:22 +01:00
|
|
|
Terraform includes a built-in selection of backends, which are listed in the
|
|
|
|
navigation sidebar. This selection has changed over time, but does not change
|
|
|
|
very often.
|
2020-10-27 02:15:36 +01:00
|
|
|
|
2021-12-07 22:07:22 +01:00
|
|
|
The built-in backends are the only backends. You cannot load additional backends
|
|
|
|
as plugins.
|
2021-01-22 06:00:34 +01:00
|
|
|
|