github.com/hugorut/terraform@v1.1.3/website/docs/language/settings/backends/consul.mdx (about)

     1  ---
     2  page_title: 'Backend Type: consul'
     3  description: Terraform can store state in Consul.
     4  ---
     5  
     6  # consul
     7  
     8  Stores the state in the [Consul](https://www.consul.io/) KV store at a given path.
     9  
    10  This backend supports [state locking](/language/state/locking).
    11  
    12  ## Example Configuration
    13  
    14  ```hcl
    15  terraform {
    16    backend "consul" {
    17      address = "consul.example.com"
    18      scheme  = "https"
    19      path    = "full/path"
    20    }
    21  }
    22  ```
    23  
    24  Note that for the access credentials we recommend using a
    25  [partial configuration](/language/settings/backends/configuration#partial-configuration).
    26  
    27  ## Data Source Configuration
    28  
    29  ```hcl
    30  data "terraform_remote_state" "foo" {
    31    backend = "consul"
    32    config = {
    33      path = "full/path"
    34    }
    35  }
    36  ```
    37  
    38  ## Configuration variables
    39  
    40  The following configuration options / environment variables are supported:
    41  
    42  - `path` - (Required) Path in the Consul KV store
    43  - `access_token` / `CONSUL_HTTP_TOKEN` - (Required) Access token
    44  - `address` / `CONSUL_HTTP_ADDR` - (Optional) DNS name and port of your Consul endpoint specified in the
    45    format `dnsname:port`. Defaults to the local agent HTTP listener.
    46  - `scheme` - (Optional) Specifies what protocol to use when talking to the given
    47    `address`, either `http` or `https`. SSL support can also be triggered
    48    by setting then environment variable `CONSUL_HTTP_SSL` to `true`.
    49  - `datacenter` - (Optional) The datacenter to use. Defaults to that of the agent.
    50  - `http_auth` / `CONSUL_HTTP_AUTH` - (Optional) HTTP Basic Authentication credentials to be used when
    51    communicating with Consul, in the format of either `user` or `user:pass`.
    52  - `gzip` - (Optional) `true` to compress the state data using gzip, or `false` (the default) to leave it uncompressed.
    53  - `lock` - (Optional) `false` to disable locking. This defaults to true, but will require session permissions with Consul and at least kv write permissions on `$path/.lock` to perform locking.
    54  - `ca_file` / `CONSUL_CACERT` - (Optional) A path to a PEM-encoded certificate authority used to verify the remote agent's certificate.
    55  - `cert_file` / `CONSUL_CLIENT_CERT` - (Optional) A path to a PEM-encoded certificate provided to the remote agent; requires use of `key_file`.
    56  - `key_file` / `CONSUL_CLIENT_KEY` - (Optional) A path to a PEM-encoded private key, required if `cert_file` is specified.