2020-03-18 18:46:47 -04:00
|
|
|
---
|
2021-01-14 14:23:39 -05:00
|
|
|
description: |
|
|
|
|
This section describes the configruation language used to create Packer
|
|
|
|
templates.
|
2020-03-18 18:46:47 -04:00
|
|
|
page_title: Templates
|
|
|
|
---
|
|
|
|
|
2021-01-14 14:23:39 -05:00
|
|
|
# Packer Templates
|
2020-03-18 18:46:47 -04:00
|
|
|
|
2021-01-14 14:23:39 -05:00
|
|
|
Packer's behavior is determined by the Packer template, which consists of a
|
|
|
|
series of declarations and commands for Packer to follow. This template tells
|
|
|
|
Packer what plugins (builders, provisioners, post-proecssors) to use, how to
|
|
|
|
configure each of those plugins, and what order to run them in.
|
2020-03-18 18:46:47 -04:00
|
|
|
|
2021-01-14 14:23:39 -05:00
|
|
|
The template contains flexible variable injection tools, as well as built-in
|
|
|
|
functions to help you customize your builds.
|
2020-03-18 18:46:47 -04:00
|
|
|
|
2021-01-14 14:23:39 -05:00
|
|
|
Historically, Packer has used a JSON template for its configuration, but Packer
|
|
|
|
is transitioning to a new template configuration format that uses HCL2 -- the
|
|
|
|
same configuration language used by Terraform and HashiCorp's other products.
|
|
|
|
This format is more flexible, more modular, and more concise than the legacy
|
|
|
|
JSON template format. While the legacy JSON format is still supported for now,
|
|
|
|
it will eventually be deprecated. In the meantime, certain new features in the
|
|
|
|
Packer core will only be implemented for the newer HCL format. Please use the
|
|
|
|
side bar to find documentation for the different template formats.
|
2020-03-18 18:46:47 -04:00
|
|
|
|
2021-01-14 14:23:39 -05:00
|
|
|
If you need help upgrading a legacy JSON template to an HCL template, check
|
|
|
|
our upgrade guide [here](/guides/hcl/from-json-v1).
|