website: add docs for variable warning bypass opts

When the options for bypassing/enabling assigned and undeclared
variables were added to Packer, the website documentation for those
commands and options was not updated.

This commit adds some documentation for those options.
This commit is contained in:
Lucas Bajolet 2022-11-16 10:57:57 -05:00 committed by Lucas Bajolet
parent bb2384c56a
commit 14cad650ca
2 changed files with 17 additions and 0 deletions

View file

@ -58,3 +58,11 @@ artifacts that are created will be outputted at the end of the build.
multiple times. This is useful for setting version numbers for your build.
- `-var-file` - Set template variables from a file.
- `-warn-on-undeclared-var` - Setting this flag will yield a warning for each assignment within
a variable definitions file (*.pkrvars.hcl | *.pkrvars.json) that does not have an accompanying
variable block. This can occur when using a var-file that contains a large amount of unused variables
for a given HCL2 template. For HCL2 template builds defining a value for a variable in a var-file is
not enough on its own for Packer to function, as there also needs to be a variable block definition in
the template files `pkr.hcl` for the variable. By default `packer build` will not warn when a var-file
contains one or more undeclared variables.

View file

@ -47,6 +47,15 @@ Errors validating build 'vmware'. 1 error(s) occurred:
source block's "name" label, unless an in-build source definition adds the
"name" configuration option.
- `-no-warn-on-undeclared-var` - Silence warnings when the a variable definition
file contains variable assignments for undeclared variables. This can occur
when using a var-file that contains a large amount of unused variables for a
given HCL2 template. For HCL2 template defining a value for a variable in a
var-file is not enough on its own for Packer to function, as there also needs
to be a variable block definition in the template files `pkr.hcl` for the
variable. By default `packer validate` will warn when a var-file contains one
or more undeclared variables.
- `-only=foo,bar,baz` - Only validate the builds with the given comma-separated
names. In legacy JSON templates, build names default to the
types of their builders (e.g. `docker` or