From ee9ebe849f9e0b4c86b3209ca74e2dbaf20ce880 Mon Sep 17 00:00:00 2001 From: Guido Bakker Date: Thu, 11 Aug 2016 12:58:20 +0200 Subject: [PATCH] Support setting datacenter when using consul remote state (#8102) * Support setting datacenter when using consul remote state Change-Id: I8c03f4058e9373f0de8fde7ce291ec552321cc60 * Add documentation for setting datacenter when using consul remote state Change-Id: Ia62feea7a910a76308f0a5e7f9505c9a210e0339 --- state/remote/consul.go | 3 +++ website/source/docs/state/remote/consul.html.md | 1 + 2 files changed, 4 insertions(+) diff --git a/state/remote/consul.go b/state/remote/consul.go index 8ac686f24..0db6e29fa 100644 --- a/state/remote/consul.go +++ b/state/remote/consul.go @@ -24,6 +24,9 @@ func consulFactory(conf map[string]string) (Client, error) { if scheme, ok := conf["scheme"]; ok && scheme != "" { config.Scheme = scheme } + if datacenter, ok := conf["datacenter"]; ok && datacenter != "" { + config.Datacenter = datacenter + } if auth, ok := conf["http_auth"]; ok && auth != "" { var username, password string if strings.Contains(auth, ":") { diff --git a/website/source/docs/state/remote/consul.html.md b/website/source/docs/state/remote/consul.html.md index 1e4422d3b..fbcb6ea46 100644 --- a/website/source/docs/state/remote/consul.html.md +++ b/website/source/docs/state/remote/consul.html.md @@ -44,5 +44,6 @@ The following configuration options / environment variables are supported: * `scheme` - (Optional) Specifies what protocol to use when talking to the given `address`, either `http` or `https`. SSL support can also be triggered by setting then environment variable `CONSUL_HTTP_SSL` to `true`. + * `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 either `user` or `user:pass`.