The source block
Note: This page is about HCL2 Packer templates. HCL2 templates were first introduced as a beta feature into Packer version 1.5. As of v1.7, HCL2 support is no longer in beta, and is the preferred way to write Packer configuration. For the old-style stable configuration language see template docs. As of v1.6.2, you can convert your legacy JSON template into an HCL2 config file using the hcl2_upgrade command.
The top-level source
block defines reusable builder configuration blocks:
The first label — happycloud
here — is the builder type. The second label is
the unique name or identifier you want to give to the source. There can be only one
source.happycloud.foo
top-level source block; but it can be used more than
once. Builders are usually found in plugins, except for the file
and the
null
builders that will remain in Packer core.
You can start builders by referring to those source blocks from a build
block :
The build-level source
block allows to set specific
source fields. Each field must be defined only once and it is currently not
allowed to override a value.
Source Variables
It is possible to access the name
and type
of your source
from
provisioners and post-processors:
Related
The list of available builders can be found in the builders section.
A list of community builders is available.
Create your own custom builder !