2017-02-15 19:47:30 +01:00
|
|
|
---
|
2021-11-23 00:47:36 +01:00
|
|
|
page_title: 'Backend Type: etcd'
|
|
|
|
description: Terraform can store state remotely in etcd 2.x.
|
2017-02-15 19:47:30 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
# etcd
|
|
|
|
|
2017-02-15 21:19:38 +01:00
|
|
|
**Kind: Standard (with no locking)**
|
|
|
|
|
2018-02-15 23:13:24 +01:00
|
|
|
Stores the state in [etcd 2.x](https://coreos.com/etcd/docs/latest/v2/README.html) at a given path.
|
2017-02-15 19:47:30 +01:00
|
|
|
|
2017-02-15 21:19:38 +01:00
|
|
|
## 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 "etcd" {
|
2017-04-05 17:29:27 +02:00
|
|
|
path = "path/to/terraform.tfstate"
|
2017-02-15 21:19:38 +01:00
|
|
|
endpoints = "http://one:4001 http://two:4001"
|
|
|
|
}
|
|
|
|
}
|
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 = "etcd"
|
2018-10-29 17:22:21 +01:00
|
|
|
config = {
|
2017-04-05 17:29:27 +02:00
|
|
|
path = "path/to/terraform.tfstate"
|
|
|
|
endpoints = "http://one:4001 http://two:4001"
|
|
|
|
}
|
2017-02-15 19:47:30 +01:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Configuration variables
|
|
|
|
|
|
|
|
The following configuration options are supported:
|
|
|
|
|
2021-11-23 00:47:36 +01:00
|
|
|
- `path` - (Required) The path where to store the state
|
|
|
|
- `endpoints` - (Required) A space-separated list of the etcd endpoints
|
|
|
|
- `username` - (Optional) The username
|
|
|
|
- `password` - (Optional) The password
|