hashicorp/nomad-pack

Error setting a dependency variable value using the `--var` flag

angrycub opened this issue · 0 comments

Currently Nomad pack will error when a user attempts to set the value for a dependency's variable using the command line as follows,

nomad-pack render fixtures/v2/test_registry/packs/deps_test_1 \
    --var job_name=A \
    --var child1.job_name=A.1 \
    --var child1.gc.job_name=A.1.a \
    --var child2.job_name=A.2 \
    --var child2.gc.job_name=A.2.a

returns an error from the render command.

! Failed To Process Pack

    Error:   There is no variable named "child1.gc.job_name". An override file can only override a variable that was
already declared in a primary configuration file.

... elided error output ...

Versus the equivalent var-file based output,

nomad-pack render fixtures/v2/test_registry/packs/deps_test_1 \
    --var-file fixtures/v2/override_files/deps_test_1/test1.hcl

which returns a successful render of the pack.

deps_test_1/deps_test.txt:

           job_name:A
    child1.job_name:A.1
 gc.child1.job_name:A.1.a
    child2.job_name:A.2
 gc.child2.job_name:A.2.a

... elided successful render output ...