mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-02-18 04:01:08 -05:00
As explained in the changes: The 'enhanced' backend terminology, which only truly pertains to the 'remote' backend with a single API (Terraform Cloud/Enterprise's), has been found to be a confusing vestige which need only be explained in the context of the 'remote' backend. These changes reorient the explanation(s) of backends to pertain more directly to their primary purpose, which is storage of state snapshots (and not implementing operations). That Terraform operations are still _implemented_ by the literal `Backend` and `Enhanced` interfaces is inconsequential a user of Terraform, an internal detail.
2.4 KiB
2.4 KiB
layout, page_title, sidebar_current, description
| layout | page_title | sidebar_current | description |
|---|---|---|---|
| language | Backend Type: consul | docs-backends-types-standard-consul | Terraform can store state in Consul. |
consul
Stores the state in the Consul KV store at a given path.
This backend supports state locking.
Example Configuration
terraform {
backend "consul" {
address = "consul.example.com"
scheme = "https"
path = "full/path"
}
}
Note that for the access credentials we recommend using a partial configuration.
Data Source Configuration
data "terraform_remote_state" "foo" {
backend = "consul"
config = {
path = "full/path"
}
}
Configuration variables
The following configuration options / environment variables are supported:
path- (Required) Path in the Consul KV storeaccess_token/CONSUL_HTTP_TOKEN- (Required) Access tokenaddress/CONSUL_HTTP_ADDR- (Optional) DNS name and port of your Consul endpoint specified in the formatdnsname:port. Defaults to the local agent HTTP listener.scheme- (Optional) Specifies what protocol to use when talking to the givenaddress, eitherhttporhttps. SSL support can also be triggered by setting then environment variableCONSUL_HTTP_SSLtotrue.datacenter- (Optional) The datacenter to use. Defaults to that of the agent.http_auth/CONSUL_HTTP_AUTH- (Optional) HTTP Basic Authentication credentials to be used when communicating with Consul, in the format of eitheruseroruser:pass.gzip- (Optional)trueto compress the state data using gzip, orfalse(the default) to leave it uncompressed.lock- (Optional)falseto disable locking. This defaults to true, but will require session permissions with Consul and at least kv write permissions on$path/.lockto perform locking.ca_file/CONSUL_CACERT- (Optional) A path to a PEM-encoded certificate authority used to verify the remote agent's certificate.cert_file/CONSUL_CLIENT_CERT- (Optional) A path to a PEM-encoded certificate provided to the remote agent; requires use ofkey_file.key_file/CONSUL_CLIENT_KEY- (Optional) A path to a PEM-encoded private key, required ifcert_fileis specified.