# Interpolation for Artifact paths

**URL:** <https://discuss.hashicorp.com/t/interpolation-for-artifact-paths/15273>\
**Category:** Nomad\
**Created:** [October 8, 2020, 8:08am UTC](https://discuss.hashicorp.com/t/interpolation-for-artifact-paths/15273 "2020-10-08T08:08:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![proffalken](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/proffalken/32/4103_2.png) [@proffalken](https://discuss.hashicorp.com/u/proffalken)\
**Post date:** [October 8, 2020, 8:08am UTC](https://discuss.hashicorp.com/t/interpolation-for-artifact-paths/15273/1 "2020-10-08T08:08:36Z")

</div>

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:

```auto
    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?

---

<div class="post-metadata">

**Author:** ![ieugen](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/ieugen/32/8867_2.png) [@ieugen](https://discuss.hashicorp.com/u/ieugen)\
**Post date:** [November 2, 2020, 4:44pm UTC](https://discuss.hashicorp.com/t/interpolation-for-artifact-paths/15273/2 "2020-11-02T16:44:35Z")

</div>

Hi,

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://${meta.nexus-username}:${meta.nexus-password}@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
    }
  }
```
