hashicorp avatar

Push To Registry

Configures Packer templates to push build metadata to the HCP Packer registry for image version tracking.

CCM score
73 of 100
skills.sh installs
3.2K
GitHub stars
941
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers the hcp_packer_registry build block, HCP service principal authentication, and querying artifacts from Terraform
  • Includes HCL template examples, a GitHub Actions workflow, and a hcp_packer_artifact data source example with channel selection
  • Enforces consistent bucket_name values, separates mutable bucket_labels from immutable build_labels, and fails builds when metadata cannot be pushed
  • Designed for teams integrating Packer image builds with HCP Packer for version control and governance

Install

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

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Push to HCP Packer Registry

Configure Packer templates to push build metadata to HCP Packer registry.

Reference: HCP Packer Registry

Note: HCP Packer is free for basic use. Builds push metadata only (not actual images), adding minimal overhead (<1 minute).

Basic Registry Configuration

packer {
  required_version = ">= 1.7.7"
}

variable "image_name" {
  type    = string
  default = "web-server"
}

locals {
  timestamp = regex_replace(timestamp(), "[- TZ:]", "")
}

source "amazon-ebs" "ubuntu" {
  region        = "us-west-2"
  instance_type = "t3.micro"

  source_ami_filter {
    filters = {
      name = "ubuntu/images/*ubuntu-jammy-22.04-amd64-server-*"
    }
    most_recent = true
    owners      = ["099720109477"]
  }

  ssh_username = "ubuntu"
  ami_name     = "${var.image_name}-${local.timestamp}"
}

build {
  sources = ["source.amazon-ebs.ubuntu"]

  hcp_packer_registry {
    bucket_name = var.image_name
    description = "Ubuntu 22.04 base image for web servers"

    bucket_labels = {
      "os"   = "ubuntu"
      "team" = "platform"
    }

Details

Repository
github.com/hashicorp/agent-skills
Category
DevOps & Cloud
First seen
Apr 16, 2026

More from hashicorp/agent-skills

All 16

Similar to Push To Registry

More DevOps & Cloud