Nomad-pack "root" function-variable

I’ve started using nomad-pack a bit, and I have a memory of reading somewhere that you can use a “generic” variable as the “root”, instead of the pack-name, but I hva not been able to find it again.

I might even remember wrong, and it is not possible…

Example:
Instead of writing "[[ .hello_world.datacenters | toStingList ]]", you can write "[[ .<some-common-variable>.datacenters | toStringList ]]"

Usecase:

  • Not have to replace all the variable-names when creating new packs from other packs…
  • Reusing templates between packs (dependencies)

Does anyone know if this is possible, and where it is documented/what this variable is called?

Hi @kds-rune,

It is possible to use the .my identifier as the generic root name instead of the pack name. In your example this would become [[ .my.datacenters | toStingList ]].

I don’t see any documentation detailing this, i’ll therefore raise an issue against the repository in a moment to track expanding the documentation to include this.

Thanks,
jrasell and the Nomad team

1 Like

That sounds like the identifier I thought/read/heard about, yes!
It doesn’t work w/version v0.0.1-techpreview2.

It seems this will be in next release. Eventually found references once I got the name of the identifier! It is also referenced under the “unreleased” part in the noad-pack changelog.

Hi @kds-rune,

nomad-pack releases nightly builds, the latest one should include this change: Release nightly · hashicorp/nomad-pack · GitHub

Thanks,
jrasell and the Nomad team