1.8 KiB
1.8 KiB
layout | page_title | sidebar_current | description |
---|---|---|---|
backend-types | Backend Type: consul | docs-backends-types-standard-consul | Terraform can store state in Consul. |
consul
Kind: Standard (with locking)
Stores the state in the Consul KV store at a given path.
This backend supports state locking.
Example Configuration
terraform {
backend "consul" {
address = "demo.consul.io"
path = "full/path"
}
}
Note that for the access credentials we recommend using a partial configuration.
Example Referencing
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
, eitherhttp
orhttps
. SSL support can also be triggered by setting then environment variableCONSUL_HTTP_SSL
totrue
.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 eitheruser
oruser:pass
.gzip
- (Optional)true
to compress the state data using gzip, orfalse
(the default) to leave it uncompressed.lock
- (Optional)false
to disable locking. This defaults to true, but will require session permissions with Consul to perform locking.