push-to-registry

Push Packer build metadata to HCP Packer registry for tracking and managing image lifecycle. Use when integrating Packer builds with HCP Packer for version control and governance.

By hashicorp · 2,642 installs

npx skills add hashicorp/agent-skills --skill push-to-registry

Source repository · Upstream listing

Push to HCP Packer Registry Configure Packer templates to push build metadata to HCP Packer registry. Reference: [HCP Packer Registry](https://developer.hashicorp.com/hcp/docs/packer) Note: HCP Packer is free for basic use. Builds push metadata only (not actual images), adding minimal overhead (<1 minute). Basic Registry Configuration Authentication Set environment variables before building: Create HCP Service Principal 1. Navigate to HCP → Access Control (IAM) 2. Create Service Principal 3. Grant "Contributor" role on project 4. Generate client secret 5. Save client ID and secret Registry Configuration Options bucket name (required) The image identifier. Must stay consistent across builds! bucket labels (optional) Metadata at bucket level. Updates with each build. build labels (optional) Metadata for each iteration. Immutable after build completes. CI/CD Integration GitHub Actions Querying in Terraform Common Issues Authentication Failed Verify HCP CLIENT ID and HCP CLIENT SECRET Ensure service principal has Contributor role Check organization and project IDs Bucket Name Mismatch Keep bucket name consistent across builds Don't include timestamps in bucket name Creates new bucket if name changes Build Fails Packer fails immediately if can't push metadata Prevents drift between artifacts and registry Check network connectivity to HCP API Best Practices Consistent bucket names Never change for same image type Meaningful labels Use for versions, teams, compliance CI/CD automation Automate builds and registry pushes Immutable build labels Put changing data (git SHA, date) in build labels References [HCP Packer Documentation](https://developer.hashicorp.com/hcp/docs/packer) [hcp packer registry Block](https://developer.hashicorp.com/packer/docs/templates/hcl templates/blocks/build/hcp packer registry) [HCP Terraform Provider](https://registry.terraform.io/providers/hashicorp/hcp/latest/docs/data sources/packer artifact)