### Provider configurations

There are times when HCL provides interpolation - the calculation of dynamic elements and variables - with use in the code. There are times where this doesn’t work much to my sadness and this is when a variable is used in a provider configuration.

Such cases are like below:

provider "nomad" {
region  = "ap-southeast-2"
}


These values are static and are used when an environment is initalised. Interpolation cannot occur on a provider for order of operation reasons. After chatting with the one and only Grant Orchard - he suggested I visit locals.

### Going Local

Locals allow me to assign a name to an expression. What I wanted to achieve was that many demonstration environments I use have different ingress DNS entries for the Amazon ELBs. That’s fine. I can address this randomness by reading off an existing statefile. Using locals allows me to refer to it simply as local.address

locals {
}


It can then be referenced many times in the same mainfest. I can define my address for my provider which needs the Nomad UI as local.address.

provider "nomad" {