2017-02-15 19:47:30 +01:00
|
|
|
---
|
2020-08-15 03:51:06 +02:00
|
|
|
layout: "language"
|
2017-02-15 21:19:38 +01:00
|
|
|
page_title: "Backend Type: local"
|
|
|
|
sidebar_current: "docs-backends-types-enhanced-local"
|
2017-02-15 19:47:30 +01:00
|
|
|
description: |-
|
2017-02-15 21:19:38 +01:00
|
|
|
Terraform can store the state remotely, making it easier to version and work with in a team.
|
2017-02-15 19:47:30 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
# local
|
|
|
|
|
2017-02-15 21:19:38 +01:00
|
|
|
**Kind: Enhanced**
|
2017-02-15 19:47:30 +01:00
|
|
|
|
2017-02-15 21:19:38 +01:00
|
|
|
The local backend stores state on the local filesystem, locks that
|
|
|
|
state using system APIs, and performs operations locally.
|
|
|
|
|
|
|
|
## Example Configuration
|
2017-02-15 19:47:30 +01:00
|
|
|
|
2017-04-05 17:29:27 +02:00
|
|
|
```hcl
|
2017-02-15 21:19:38 +01:00
|
|
|
terraform {
|
|
|
|
backend "local" {
|
|
|
|
path = "relative/path/to/terraform.tfstate"
|
|
|
|
}
|
|
|
|
}
|
2017-02-15 19:47:30 +01:00
|
|
|
```
|
|
|
|
|
2020-02-19 01:40:14 +01:00
|
|
|
## Data Source Configuration
|
2017-02-15 19:47:30 +01:00
|
|
|
|
2017-04-05 17:29:27 +02:00
|
|
|
```hcl
|
2017-02-15 19:47:30 +01:00
|
|
|
data "terraform_remote_state" "foo" {
|
2017-04-05 17:29:27 +02:00
|
|
|
backend = "local"
|
2017-02-15 21:19:38 +01:00
|
|
|
|
2018-10-29 17:22:21 +01:00
|
|
|
config = {
|
2017-04-05 17:29:27 +02:00
|
|
|
path = "${path.module}/../../terraform.tfstate"
|
|
|
|
}
|
2017-02-15 19:47:30 +01:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Configuration variables
|
|
|
|
|
|
|
|
The following configuration options are supported:
|
|
|
|
|
2017-02-15 21:19:38 +01:00
|
|
|
* `path` - (Optional) The path to the `tfstate` file. This defaults to
|
|
|
|
"terraform.tfstate" relative to the root module by default.
|
2019-08-28 21:34:22 +02:00
|
|
|
* `workspace_dir` - (Optional) The path to non-default workspaces.
|