website/content/docs/templates/hcl_templates/blocks/index.mdx
⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
[!IMPORTANT]
Documentation Update: Product documentation previously located in/websitehas moved to thehashicorp/web-unified-docsrepository, where all product documentation is now centralized. Please make contributions directly toweb-unified-docs, since changes to/websitein this repository will not appear on developer.hashicorp.com. ⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
This topic provides an overview of the configuration blocks built into the Packer language that you can use to write Packer templates in HCL2.
A block is a container for configuration. You can use the following types of blocks in your Packer templates:
build blocks contain configuration for a specific combination of builders,
provisioners, and post-processors used to create a specific image artifact.source blocks contain configuration for builder plugins. Once defined,
sources can be used and further configured by the "build" block.provisioner blocks contain configuration for provisioner plugins. These
blocks are nested inside of a build block.post-processor and post-processors blocks contain configuration for
post-processor plugins and post-processor plugin sequences. They are also
nested within build blocks.variable blocks contain configuration for variables that can either be
defaulted in configuration or set by the user at runtime.locals blocks contain configuration for variables that can be created using
HCL functions or data sources, or composited from variables created in the
variables blocks.The documentation contains information for each block type.
Other blocks, such as the packer block, provide information to the Packer core
about what version it is allowed to run. The required_plugins block helps the
Packer core
Blocks can be defined in multiple files and packer build folder will build
using solely the files from a directory named folder.
Packer does not support user-defined blocks and so only the blocks built in to the language are available for use. The documentation includes all of the available built-in HCL2 blocks.
@include 'from-1.5/variables/foo-block.mdx'
@include 'from-1.5/locals/example-block.mdx'
@include 'from-1.5/sources/example-block.mdx'
@include 'from-1.5/builds/example-block.mdx'
@include 'from-1.5/datasources/example-block.mdx'