1

fetch the information from Consul and then submit this job to Nomad, injecting the Consul k/v value as an environment variable.

like for example i have a value in consul k/v which is

testData = "HELLO"

on the other hand, in my job.

i want the value from consul k/v to be injected to env stanza as a value.

env
CONSUL_test = <value of consul k/v testData>

is this possible?

so that when i inspect the docker env, i must see

CONSUL_test = HELLO
rkevx21
  • 2,441
  • 5
  • 19
  • 40

1 Answers1

2

nomad uses consul-templating, so you can reference consul k/v values in your nomad spec by doing {{ key "myKey" }}. https://www.nomadproject.io/docs/job-specification/template.html

klhr
  • 3,300
  • 1
  • 11
  • 25