# External variables

**URL:** <https://discuss.hashicorp.com/t/external-variables/36293>\
**Category:** Nomad\
**Created:** [February 28, 2022, 8:31am UTC](https://discuss.hashicorp.com/t/external-variables/36293 "2022-02-28T08:31:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![matthiasveelaert](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/matthiasveelaert/32/23944_2.png) [@matthiasveelaert](https://discuss.hashicorp.com/u/matthiasveelaert)\
**Post date:** [February 28, 2022, 8:31am UTC](https://discuss.hashicorp.com/t/external-variables/36293/1 "2022-02-28T08:31:12Z")

</div>

Hi there, I am looking to user some extra external variables to write into my nomad job with a raw\_exec driver. I saw that this is possible using the -var flag in the nomad job run command. How would I go about using these variables in the job itself. How can I access these variables?

Thanks!

---

<div class="post-metadata">

**Author:** ![brettpatricklarson](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/brettpatricklarson/32/24909_2.png) [@brettpatricklarson](https://discuss.hashicorp.com/u/brettpatricklarson)\
**Post date:** [March 30, 2022, 3:01am UTC](https://discuss.hashicorp.com/t/external-variables/36293/2 "2022-03-30T03:01:44Z")

</div>

Define the variable in the job file and then use `var.foo` to call it.

> [@Nomad HCL2 Function Examples](https://discuss.hashicorp.com/t/nomad-hcl2-function-examples/19677/2):
>
> Hi @jeff.couvrette and thanks for the question. One use case which I have personally had in the past is injecting Docker image tags within CI systems, where an application build triggers a downsteam deployment and passes it the newly produced version identifier to deploy. A example job specification for how this might look would be as follows: variable "image\_version" { type = string default = "latest" } job "example" { datacenters = ["dc1"] group "cache" { network { port…
