Questions tagged [consul-template]

Consul template renders Go templates based on data queried from HashiCorp Consul.

Consul template is a simple, yet powerful tool. When initiated, it reads one or more template files and queries Consul for all data needed to render them. Typically, you run consul-template as a daemon which will fetch the initial values and then continue to watch for updates, re-rendering the template whenever there are relevant changes in the cluster.

The tag should be used for tool specific questions like daemon setup or usage of provided template functions. More general Go template questions should be tagged with instead.

75 questions
2
votes
1 answer

How do I use variable within consul-template range construct?

We have multiple environments for our apps, and I am trying to use generic consul template and an environment variable to create haproxy configurations for different environments. This is what I am trying to do: {{$environment := "yellow"…
2
votes
1 answer

consul-template using Address not ServiceAddress in template

I am having a problem in that consul-template seems to be substituting the service "ServiceAddress" and not "Address" in my template and I wonder if anyone can tell me why. From a bash session within my nginx container where consul-template is also…
KnownColor
  • 449
  • 5
  • 12
1
vote
1 answer

Nomad job: interpolating within Docker args

I'm writing a Thanos sidecar job for Prometheus. I have looked and can't figure out how to specify this argument in a config file, so my job looks like this. This is a templatefile for Terraform, so if you try to reference ${var}, Terraform tries…
1
vote
0 answers

consul-template file per key-value

I have a use case where i need consul template to watch multiple keys at a specific path. The number of keys at that path are variable. For each key under that path, it needs to grab the value and put it in a destination file on the host file…
cybervedaa
  • 309
  • 2
  • 10
1
vote
1 answer

How can i set automaticly registered services on nginx config using consul template

I'm using consul, consul-template and nginx on docker. When adding each new service, i have to change consul-template source file again. By the way all we're using soap services and proxy. All of them have service uri. How can i write nginx.ctmpl…
1
vote
1 answer

automatically reload Kubernetes pod on consul key change

I have a consul server running on https://dev.example.com/ on which I store configurations as below: consul key name = dev consul key value = some yaml data kubernetes configMap value some yaml data --> ( this is in sync with consul data ) what I…
Ajay k
  • 143
  • 1
  • 2
  • 11
1
vote
1 answer

How to use Variables in Consul-template config file?

How to use Variables in consul-template config file? I have consul templates which I want to run and below is my consul-template configuration: vault { address = "http://$VAULT_ADDR:8200" token = "sometoken" unwrap_token = false …
Kingindanord
  • 1,754
  • 2
  • 19
  • 48
1
vote
1 answer

Consul Data Center: Leader node not automatically selected after failure of previous leader node

I'm new to Consul and I have created a one Data Center with 2 server nodes. I followed the steps provided in this documentation, https://learn.hashicorp.com/tutorials/consul/deployment-guide?in=consul/datacenter-deploy The nodes are successfully…
1
vote
0 answers

Consul-Termplate - What's the syntax for inserting variables into a "with secret" certificate call

I'm trying to download a server specific certificate and key from vault to each of my consul servers using the template function of vault-agent. The recommended approach is to set a common name and SAN as HOSTNAME.DATACENTER.DOMAIN. I am using a…
1
vote
0 answers

Hashicorp - Multiple credential pairs in a single object

Let's say, I have two users online and batch who do CRUD operations on resources of a custom server. These two users have different access levels for different resources. I want to create one object such that, the server recognizes the credential…
1
vote
0 answers

Is it possible to run consul-template in a different container then a consul cluster

I have consul cluster running in k8s. And I need consul-template to render some configuration. Is it possible to run consul-template in a separate container or it must be running on each consul server in a cluster?
user1443543
  • 25
  • 1
  • 5
1
vote
2 answers

Get iterator index in go template (consul-template)

I'm trying to get a simple index that I can append to output of a Go template snippet using consul-template. Looked around a bit and couldn't figure out the simple solution. Basically, given this input backend web_back balance roundrobin …
4m1r
  • 12,234
  • 9
  • 46
  • 58
1
vote
1 answer

consul-template: [WARN] vault.token: TTL of xxyyzz exceeded the effective max_ttl of xxyyzz; TTL value is capped accordingly

The problem of unresponsive consul-template occurs while querying a set of keys. The vault and consul tokens are valid and still 'vault.token' has a TTL expiry warning. After the warning, all the key lookups get an HTTP 504.
Vishal K
  • 1,164
  • 1
  • 10
  • 21
1
vote
1 answer

Reading secrets with consul-template from vault

I have vault running in a pod. I can read secrets using vault read. $ vault read test Key Value --- ----- refresh_interval 768h value world $ vault kv get test ==== Data ==== Key Value --- …
hkhelil
  • 358
  • 2
  • 13
1
vote
0 answers

Consul-Template returns empty map?

Hi everyone, I am trying to fetch a client token from approle auth method in vault. I have configured consul-template that it gets the role-id and the secret-id then, uses them to get the client_token at auth/approle/login end point. What is really…
Badr
  • 694
  • 1
  • 7
  • 26