Interpolation for Artifact paths

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 or depending on the value of the environment variable.

Is this something that is possible to do?


I’m also curios on how to do interpolation in artifacts source.
I would like to download from private repo and specify a version:

      artifact {
    source = "https://${}:${}@nexus.REDACTED/repository/releases/path/to/artifacts/${meta.sample-db-version}/dev-db-${meta.sample-version}.sql.gz"

    destination = "local/initdb/dev-db.sql.gz"
    mode = "file"

    options {
      archive = false