2013-07-14 04:38:31 -04:00
|
|
|
---
|
2017-06-14 21:04:16 -04:00
|
|
|
description: |
|
2020-03-18 18:46:47 -04:00
|
|
|
The `packer fix` command takes a template and finds backwards incompatible
|
|
|
|
parts of it and brings it up to date so it can be used with the latest version
|
|
|
|
of Packer. After you update to a new Packer release, you should run the fix
|
|
|
|
command to make sure your templates work with the new release.
|
|
|
|
page_title: packer fix - Commands
|
2020-04-02 19:39:47 -04:00
|
|
|
sidebar_title: <tt>fix</tt>
|
2017-03-25 18:13:52 -04:00
|
|
|
---
|
2013-07-14 04:38:31 -04:00
|
|
|
|
2017-03-25 18:13:52 -04:00
|
|
|
# `fix` Command
|
2013-07-14 04:38:31 -04:00
|
|
|
|
2021-02-16 08:09:32 -05:00
|
|
|
-> **Note** This command is not available on HCL2 templates yet, it will be added when we need to introduce the first 'fix'.
|
2021-02-16 04:08:47 -05:00
|
|
|
|
2017-03-25 18:13:52 -04:00
|
|
|
The `packer fix` command takes a template and finds backwards incompatible
|
|
|
|
parts of it and brings it up to date so it can be used with the latest version
|
|
|
|
of Packer. After you update to a new Packer release, you should run the fix
|
|
|
|
command to make sure your templates work with the new release.
|
2013-07-14 04:38:31 -04:00
|
|
|
|
2015-07-22 22:31:00 -04:00
|
|
|
The fix command will output the changed template to standard out, so you should
|
2020-07-15 12:39:43 -04:00
|
|
|
redirect standard out using standard OS-specific techniques if you want to save it
|
2015-07-22 22:31:00 -04:00
|
|
|
to a file. For example, on Linux systems, you may want to do this:
|
2013-07-14 04:38:31 -04:00
|
|
|
|
2020-05-29 17:12:05 -04:00
|
|
|
```shell-session
|
2017-03-25 18:13:52 -04:00
|
|
|
$ packer fix old.json > new.json
|
|
|
|
```
|
2013-07-14 04:38:31 -04:00
|
|
|
|
2015-07-22 22:31:00 -04:00
|
|
|
If fixing fails for any reason, the fix command will exit with a non-zero exit
|
|
|
|
status. Error messages appear on standard error, so if you're redirecting
|
2013-07-14 04:38:31 -04:00
|
|
|
output, you'll still see error messages.
|
|
|
|
|
2020-03-23 20:02:12 -04:00
|
|
|
-> **Even when Packer fix doesn't do anything** to the template, the
|
2018-10-26 20:02:51 -04:00
|
|
|
template will be outputted to standard out. Things such as configuration key
|
|
|
|
ordering and indentation may be changed. The output format however, is
|
|
|
|
pretty-printed for human readability.
|
2013-07-14 04:38:31 -04:00
|
|
|
|
2015-07-22 22:31:00 -04:00
|
|
|
The full list of fixes that the fix command performs is visible in the help
|
|
|
|
output, which can be seen via `packer fix -h`.
|
2018-03-25 23:38:41 -04:00
|
|
|
|
|
|
|
## Options
|
|
|
|
|
2020-03-18 18:46:47 -04:00
|
|
|
- `-validate=false` - Disables validation of the fixed template. True by
|
|
|
|
default.
|