HCP Packer Iteration Data Source
Type: hcp-packer-iteration
The HCP Packer Iteration
Data Source retrieves information about an
iteration from the HCP Packer registry. This information can be used to query
HCP for a source image for various Packer builders.
To get started with HCP Packer, refer to the HCP Packer documentation or try the Get Started with HCP Packer tutorials.
Note: You will receive an error if you try to reference metadata from a deactivated or deleted registry. An administrator can manually deactivate or delete a registry, and HCP Packer automatically deactivates registries with billing issues. Contact HashiCorp Support with questions.
Revoked Iterations
If an iteration is revoked, the hcp-packer-iteration
data source will fail and Packer won't proceed with the build. Building new images from a revoked image is not compliant.
Iterations that are scheduled to be revoked will still be considered valid until the revocation date.
Basic Example
Below is a fully functioning example. It stores information about an image iteration, which can then be accessed as a variable.
Full Example
This data source can be used in conjunction with the hcp-packer-image data source to retrieve an image ID using a channel. You provide the channel name to the iteration data source, then use the iteration source inside the image data source, then use the image data source inside your source block.
Configuration Reference
Configuration options are organized below into two categories: required and optional. Within each category, the available options are alphabetized and described.
Required:
bucket_name
(string) - The name of the bucket your image is in.channel
(string) - The name of the channel to use when retrieving your image
There are currently no optional fields for this datasource, though we intend to add filtering fields in the future.
Output Fields:
author_id
(string) - who created the iterationbucket_name
(string) - Name of the bucket that the iteration was retrieved fromcomplete
(bool) - If true, this iteration is considered "ready to use" and will be returned even if the include_incomplete flag is "false" in the list iterations request. Note that if you are retrieving an iteration using a channel, this will always be "true"; channels cannot be assigned to incomplete iterations.created_at
(string) - The date the iteration was created.fingerprint
(string) - The fingerprint of the build; this could be a git sha or other unique identifier as set by the Packer build that created this iteration.id
(string) - The iteration ID. This is a ULID, which is a unique identifier similar to a UUID. It is created by the HCP Packer Registry when an iteration is first created, and is unique to this iteration.incremental_version
(int32) - The version number assigned to an iteration. This number is an integer, and is created by the HCP Packer Registry once an iteration is marked "complete". If a new iteration is marked "complete", the version that HCP Packer assigns to it will always be the highest previous iteration version plus one.updated_at
(string) - The date when this iteration was last updated.channel_id
(string) - The ID of the channel used to query the image iteration.