• HashiCorp Developer

  • HashiCorp Cloud Platform
  • Terraform
  • Packer
  • Consul
  • Vault
  • Boundary
  • Nomad
  • Waypoint
  • Vagrant
Terraform
  • Install
  • Tutorials
    • About the Docs
    • Configuration Language
    • Terraform CLI
    • Terraform Cloud
    • Terraform Enterprise
    • CDK for Terraform
    • Provider Use
    • Plugin Development
    • Registry Publishing
    • Integration Program
  • Registry(opens in new tab)
  • Try Cloud(opens in new tab)
  • Sign up
Terraform Home

Configuration Language

Skip to main content
  • Configuration Language
  • Terraform Language

  • Overview
  • Data Sources
    • Overview
    • Terraform Cloud
      • Backend Configuration
        • local
        • remote
        • artifactory
        • azurerm
        • consul
        • cos
        • etcd
        • etcdv3
        • gcs
        • http
        • Kubernetes
        • manta
        • oss
        • pg
        • s3
        • swift
  • Upgrading to Terraform v1.2
  • v1.x Compatibility Promises

  • Terraform Internals

  • Resources

  • Tutorial Library
  • Certifications
  • Community Forum
    (opens in new tab)
  • Support
    (opens in new tab)
  • GitHub
    (opens in new tab)
  • Terraform Registry
    (opens in new tab)

You are viewing documentation for version v1.2.x. View latest version.

  1. Developer
  2. Terraform
  3. Configuration Language v1.2.x
  4. Terraform Settings
  5. Backends
  6. etcdv3
  • Terraform
  • v1.3.x (latest)
  • v1.1 and earlier

»etcdv3 (deprecated)

Note: The etcdv3 backend is deprecated and will be removed in a future Terraform release.

Stores the state in the etcd KV store with a given prefix.

This backend supports state locking.

Example Configuration

terraform {
  backend "etcdv3" {
    endpoints = ["etcd-1:2379", "etcd-2:2379", "etcd-3:2379"]
    lock      = true
    prefix    = "terraform-state/"
  }
}

Note that for the access credentials we recommend using a partial configuration.

Data Source Configuration

data "terraform_remote_state" "foo" {
  backend = "etcdv3"
  config = {
    endpoints = ["etcd-1:2379", "etcd-2:2379", "etcd-3:2379"]
    lock      = true
    prefix    = "terraform-state/"
  }
}

Configuration Variables

Warning: We recommend using environment variables to supply credentials and other sensitive data. If you use -backend-config or hardcode these values directly in your configuration, Terraform will include these values in both state and plan files. Refer to Credentials and Sensitive Data for details.

The following configuration options / environment variables are supported:

  • endpoints - (Required) The list of 'etcd' endpoints which to connect to.
  • username / ETCDV3_USERNAME - (Optional) Username used to connect to the etcd cluster.
  • password / ETCDV3_PASSWORD - (Optional) Password used to connect to the etcd cluster.
  • prefix - (Optional) An optional prefix to be added to keys when to storing state in etcd. Defaults to "".
  • lock - (Optional) Whether to lock state access. Defaults to true.
  • cacert_path - (Optional) The path to a PEM-encoded CA bundle with which to verify certificates of TLS-enabled etcd servers.
  • cert_path - (Optional) The path to a PEM-encoded certificate to provide to etcd for secure client identification.
  • key_path - (Optional) The path to a PEM-encoded key to provide to etcd for secure client identification.
  • 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 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.

On this page

  1. etcdv3 (deprecated)
  2. Example Configuration
  3. Data Source Configuration
  4. Configuration Variables
Give Feedback(opens in new tab)
  • Certifications
  • System Status
  • Terms of Use
  • Security
  • Privacy
  • Trademark Policy
  • Trade Controls
  • Give Feedback(opens in new tab)