2013-06-20 17:13:35 -04:00
|
|
|
---
|
2017-06-14 21:04:16 -04:00
|
|
|
description: |
|
|
|
|
The `packer validate` Packer command is used to validate the syntax and
|
|
|
|
configuration of a template. The command will return a zero exit status on
|
|
|
|
success, and a non-zero exit status on failure. Additionally, if a template
|
|
|
|
doesn't validate, any error messages will be outputted.
|
2015-07-22 22:31:00 -04:00
|
|
|
layout: docs
|
2017-06-14 21:04:16 -04:00
|
|
|
page_title: 'packer validate - Commands'
|
|
|
|
sidebar_current: 'docs-commands-validate'
|
2017-03-25 18:13:52 -04:00
|
|
|
---
|
2013-06-20 17:13:35 -04:00
|
|
|
|
2017-03-25 18:13:52 -04:00
|
|
|
# `validate` Command
|
2013-06-20 17:13:35 -04:00
|
|
|
|
2015-07-22 22:31:00 -04:00
|
|
|
The `packer validate` Packer command is used to validate the syntax and
|
2017-03-28 18:28:34 -04:00
|
|
|
configuration of a [template](/docs/templates/index.html). The command
|
2015-07-22 22:31:00 -04:00
|
|
|
will return a zero exit status on success, and a non-zero exit status on
|
|
|
|
failure. Additionally, if a template doesn't validate, any error messages will
|
|
|
|
be outputted.
|
2013-06-20 17:13:35 -04:00
|
|
|
|
|
|
|
Example usage:
|
|
|
|
|
2017-06-14 21:04:16 -04:00
|
|
|
``` text
|
2013-06-20 17:13:35 -04:00
|
|
|
$ packer validate my-template.json
|
|
|
|
Template validation failed. Errors are shown below.
|
|
|
|
|
|
|
|
Errors validating build 'vmware'. 1 error(s) occurred:
|
|
|
|
|
|
|
|
* Either a path or inline script must be specified.
|
|
|
|
```
|
|
|
|
|
|
|
|
## Options
|
|
|
|
|
2017-06-14 21:04:16 -04:00
|
|
|
- `-syntax-only` - Only the syntax of the template is checked. The configuration
|
|
|
|
is not validated.
|
2018-03-25 23:38:41 -04:00
|
|
|
|
|
|
|
- `-except=foo,bar,baz` - Builds all the builds except those with the given
|
|
|
|
comma-separated names. Build names by default are the names of their builders,
|
|
|
|
unless a specific `name` attribute is specified within the configuration.
|
|
|
|
|
|
|
|
- `-only=foo,bar,baz` - Only build the builds with the given comma-separated
|
|
|
|
names. Build names by default are the names of their builders, unless a
|
|
|
|
specific `name` attribute is specified within the configuration.
|
|
|
|
|
|
|
|
- `-var` - Set a variable in your packer template. This option can be used
|
|
|
|
multiple times. This is useful for setting version numbers for your build.
|
|
|
|
|
|
|
|
- `-var-file` - Set template variables from a file.
|