Hey all,
I’m working on a platform that has Nomad, Consul, and Vault installed, and I’m trying to retrieve a template file for a Nomad job from another container that is already registered in Consul.
I want this job definition to be portable across our various environments, so I’m trying to use interpolation in the Nomad job definition in order to pull from the correct location
The code I’m trying is as follows:
task "app-server" {
artifact {
source = "http://nomad-templates.${"CONSUL_DOMAIN"}/chirpstack_as.toml.hcl"
destination = "local/chirpstack_app.toml.hcl"
}
template {
source = "local/chirpstack_app.toml.hcl"
destination = "/media/chirpstack-app/chirpstack-application-server.toml"
left_delimiter = "#{"
right_delimiter = "}#"
}
where CONSUL_DOMAIN
is exported on the machine that execute nomad run <my job name>
and converts the artifact URL to something like http://nomad-templates.service.prod.mycompany.org
or http://nomad-templates.service.staging.mycompany.org
depending on the value of the environment variable.
Is this something that is possible to do?