ThinkWithPrompt by SynotticThinkWithPrompt

Build a hardened golden machine image with Packer

A Packer HCL2 template, unattended install config, and pipeline plan for reproducible, hardened VM or cloud images.

Software DevelopmentFew-ShotStandardDesignFill-in Template

The prompt

Help me build a reproducible "golden" machine image with HashiCorp Packer. Target platforms: [e.g. AWS AMI, Azure, GCP, VMware vSphere, Proxmox] Base OS and version: [e.g. Ubuntu 24.04, RHEL 9, Windows Server 2022] Install method: [cloud base image / ISO with unattended install: autoinstall, preseed, Kickstart, or Autounattend.xml] What the image must include: [packages, agents, users, config] Hardening standard: [e.g. CIS Level 1, internal baseline, none yet] Provisioner preference: [shell, PowerShell, Ansible] Day-0 customization: [cloud-init / cloudbase-init needs] Build pipeline: [where builds run, e.g. GitHub Actions, GitLab CI, Jenkins] Produce: 1. A Packer HCL2 template split into sensible files (plugins block with pinned versions, variables with descriptions, sources, build). 2. The unattended install file for my OS, if building from ISO. 3. Provisioning steps in order: updates, packages, hardening, cleanup (remove SSH host keys, machine-id, logs, cloud-init state, temporary credentials) so every instance boots unique. 4. Secrets handling: no passwords or keys in the template; use environment variables or a secrets manager. 5. Validation: packer validate, a smoke test of the built image, and how to tag images with version, date, and source commit. 6. A CI pipeline outline for scheduled rebuilds and image retirement. Point out common failure points (boot command timing, WinRM/SSH communicator timeouts, cloud-init running twice). Mark any plugin option you are unsure of as [VERIFY IN PLUGIN DOCS].

Highlighted [brackets] are blanks to replace with your own details.

Fill in the blanks and use this promptMore Software Development prompts

What to fill in

  • e.g. AWS AMI, Azure, GCP, VMware vSphere, Proxmox
  • e.g. Ubuntu 24.04, RHEL 9, Windows Server 2022
  • packages, agents, users, config
  • e.g. CIS Level 1, internal baseline, none yet
  • shell, PowerShell, Ansible
  • cloud-init / cloudbase-init needs
  • where builds run, e.g. GitHub Actions, GitLab CI, Jenkins
  • VERIFY IN PLUGIN DOCS

How this prompt is built

This prompt follows the Few-Shot structure (Few-shot prompting). A few-shot prompt includes one or more worked examples of the input and the output you want, so the model can copy the pattern instead of guessing it.

Related prompts

Find more prompts like this