1--- 2layout: "language" 3page_title: "Backend Type: etcdv3" 4sidebar_current: "docs-backends-types-standard-etcdv3" 5description: |- 6 Terraform can store state remotely in etcd 3.x. 7--- 8 9# etcdv3 10 11**Kind: Standard (with locking)** 12 13Stores the state in the [etcd](https://etcd.io/) KV store with a given prefix. 14 15This backend supports [state locking](/docs/language/state/locking.html). 16 17## Example Configuration 18 19```hcl 20terraform { 21 backend "etcdv3" { 22 endpoints = ["etcd-1:2379", "etcd-2:2379", "etcd-3:2379"] 23 lock = true 24 prefix = "terraform-state/" 25 } 26} 27``` 28 29Note that for the access credentials we recommend using a 30[partial configuration](/docs/language/settings/backends/configuration.html#partial-configuration). 31 32## Data Source Configuration 33 34```hcl 35data "terraform_remote_state" "foo" { 36 backend = "etcdv3" 37 config = { 38 endpoints = ["etcd-1:2379", "etcd-2:2379", "etcd-3:2379"] 39 lock = true 40 prefix = "terraform-state/" 41 } 42} 43``` 44 45## Configuration variables 46 47The following configuration options / environment variables are supported: 48 49 * `endpoints` - (Required) The list of 'etcd' endpoints which to connect to. 50 * `username` / `ETCDV3_USERNAME` - (Optional) Username used to connect to the etcd cluster. 51 * `password` / `ETCDV3_PASSWORD` - (Optional) Password used to connect to the etcd cluster. 52 * `prefix` - (Optional) An optional prefix to be added to keys when to storing state in etcd. Defaults to `""`. 53 * `lock` - (Optional) Whether to lock state access. Defaults to `true`. 54 * `cacert_path` - (Optional) The path to a PEM-encoded CA bundle with which to verify certificates of TLS-enabled etcd servers. 55 * `cert_path` - (Optional) The path to a PEM-encoded certificate to provide to etcd for secure client identification. 56 * `key_path` - (Optional) The path to a PEM-encoded key to provide to etcd for secure client identification. 57 * `max_request_bytes` - (Optional) The max request size to send to etcd. This can be increased to enable storage of larger state. You must set the corresponding server-side flag [--max-request-bytes](https://etcd.io/docs/current/dev-guide/limit/#request-size-limit) as well and the value should be less than the client setting. Defaults to `2097152` (2.0 MiB). **Please Note:** Increasing etcd's request size limit may negatively impact overall latency. 58