github.com/hashicorp/packer@v1.14.3/website/content/docs/datasources/hcp/hcp-packer-version.mdx (about) 1 --- 2 description: | 3 The `hcp-packer-version` data source retrieves information about 4 an HCP Packer version from the HCP Packer registry. Use this information to 5 get a source's external identifier. 6 page_title: hcp-packer-version data source reference 7 --- 8 9 <BadgesHeader> 10 <PluginBadge type="official" /> 11 <PluginBadge type="hcp_packer_ready" /> 12 </BadgesHeader> 13 14 # `hcp-packer-version` 15 16 The `hcp-packer-version` dsata source retrieves information about 17 an HCP Packer version from the HCP Packer registry. You can use the version information to 18 query HCP for a source's external identifier so that you can use it in various Packer builders. 19 20 To get started with HCP Packer, refer to the [HCP Packer documentation](/hcp/docs/packer) or try the 21 [Get Started with HCP Packer tutorials](/packer/tutorials/hcp-get-started). 22 23 Packer prints an error if you try to reference metadata from a deactivated or deleted registry. 24 An administrator can manually deactivate or delete a registry, and HCP Packer automatically deactivates registries with billing issues. Contact [HashiCorp Support](https://support.hashicorp.com/) with questions. 25 26 ## Revoked Versions 27 28 If an HCP Packer Version is revoked, the `hcp-packer-version` data source will fail and Packer won't proceed with 29 the build. Building new artifacts from a revoked artifact is not compliant. 30 Versions that are scheduled to be revoked will still be considered valid until the revocation date. 31 32 ## Basic Example 33 34 Below is a fully functioning example. It stores information about an HCP Packer Version, which can then be accessed as a variable. 35 36 ```hcl 37 data "hcp-packer-version" "hardened-source" { 38 bucket_name = "hardened-ubuntu-16-04" 39 channel_name = "dev" 40 } 41 ``` 42 43 ## Full Example 44 45 This data source can be used in conjunction with the `hcp-packer-artifact` 46 data source to retrieve an artifact identifier. You provide the version fingerprint and channel 47 name to the version data source, then use the version source inside the 48 artifact data source, then use the artifact data source inside your source block. 49 50 ```hcl 51 # Retrieves information about the HCP Packer Version; a "version" can be 52 # thought of as all the metadata created by a single call of `packer build`. 53 data "hcp-packer-version" "hardened-source" { 54 bucket_name = "hardened-ubuntu-16-04" 55 channel_name = "dev" 56 } 57 58 # Retrieves information about the HCP Packer Artifact; an artifact can be thought 59 # of as all the metadata (including the artifact names) created by a single 60 # "source" builder; this can include multiple artifacts so we provide a 61 # region to disambiguate. 62 data "hcp-packer-artifact" "example" { 63 bucket_name = "hardened-ubuntu-16-04" 64 version_fingerprint = data.hcp-packer-version.hardened-source.fingerprint 65 platform = "aws" 66 region = "us-east-1" 67 } 68 69 # This source uses the output from a previous Packer build. By using the 70 # HCP Packer Registry in this way, you can easily create build pipelines where 71 # a single base artifact can be customized in multiple secondary layers. 72 source "amazon-ebs" "packer-secondary" { 73 source_ami = data.hcp-packer-artifact.example.external_identifier 74 ... 75 } 76 ``` 77 78 ## Configuration Reference 79 80 Configuration options are organized below into two categories: required and 81 optional. Within each category, the available options are alphabetized and 82 described. 83 84 ### Required: 85 86 @include 'datasource/hcp-packer-version/Config-required.mdx' 87 88 There are currently no optional fields for this datasource, though we intend 89 to add filtering fields in the future. 90 91 ### Output Fields: 92 93 @include 'datasource/hcp-packer-version/DatasourceOutput.mdx'