Packer - Build d'images (VMs, containers, ISOs)
Find a file
Hari eee3805c06
Some checks are pending
build / get-go-version (push) Waiting to run
build / set-product-version (push) Waiting to run
build / generate-metadata-file (push) Blocked by required conditions
build / Go ${{ needs.get-go-version.outputs.go-version }} freebsd 386 build (push) Blocked by required conditions
build / Go ${{ needs.get-go-version.outputs.go-version }} netbsd 386 build (push) Blocked by required conditions
build / Go ${{ needs.get-go-version.outputs.go-version }} openbsd 386 build (push) Blocked by required conditions
build / Go ${{ needs.get-go-version.outputs.go-version }} solaris 386 build (push) Blocked by required conditions
build / Go ${{ needs.get-go-version.outputs.go-version }} windows 386 build (push) Blocked by required conditions
build / Go ${{ needs.get-go-version.outputs.go-version }} freebsd amd64 build (push) Blocked by required conditions
build / Go ${{ needs.get-go-version.outputs.go-version }} netbsd amd64 build (push) Blocked by required conditions
build / Go ${{ needs.get-go-version.outputs.go-version }} openbsd amd64 build (push) Blocked by required conditions
build / Go ${{ needs.get-go-version.outputs.go-version }} solaris amd64 build (push) Blocked by required conditions
build / Go ${{ needs.get-go-version.outputs.go-version }} windows amd64 build (push) Blocked by required conditions
build / Go ${{ needs.get-go-version.outputs.go-version }} freebsd arm build (push) Blocked by required conditions
build / Go ${{ needs.get-go-version.outputs.go-version }} netbsd arm build (push) Blocked by required conditions
build / Go ${{ needs.get-go-version.outputs.go-version }} openbsd arm build (push) Blocked by required conditions
build / Go ${{ needs.get-go-version.outputs.go-version }} linux 386 build (push) Blocked by required conditions
build / Go ${{ needs.get-go-version.outputs.go-version }} linux amd64 build (push) Blocked by required conditions
build / Go ${{ needs.get-go-version.outputs.go-version }} linux arm build (push) Blocked by required conditions
build / Go ${{ needs.get-go-version.outputs.go-version }} linux arm64 build (push) Blocked by required conditions
build / Go ${{ needs.get-go-version.outputs.go-version }} linux ppc64le build (push) Blocked by required conditions
build / Go ${{ needs.get-go-version.outputs.go-version }} darwin amd64 build (push) Blocked by required conditions
build / Go ${{ needs.get-go-version.outputs.go-version }} darwin arm64 build (push) Blocked by required conditions
build / Docker light 386 build (push) Blocked by required conditions
build / Docker light amd64 build (push) Blocked by required conditions
build / Docker light arm build (push) Blocked by required conditions
build / Docker light arm64 build (push) Blocked by required conditions
build / Docker full 386 build (push) Blocked by required conditions
build / Docker full amd64 build (push) Blocked by required conditions
build / Docker full arm build (push) Blocked by required conditions
build / Docker full arm64 build (push) Blocked by required conditions
Go Test / get-go-version (push) Waiting to run
Go Test / Linux go tests (push) Blocked by required conditions
Go Test / Darwin go tests (push) Blocked by required conditions
Go Test / Windows go tests (push) Blocked by required conditions
Go Validate / get-go-version (push) Waiting to run
Go Validate / Go Mod Tidy (push) Blocked by required conditions
Go Validate / Lint (push) Blocked by required conditions
Go Validate / Fmt check (push) Blocked by required conditions
Go Validate / Generate check (push) Blocked by required conditions
Feature/enforced provisioner (#13591)
* added the parser for the enforced block

* Enhance enforced provisioner parsing to support HCL and JSON formats

- Updated ParseProvisionerBlocks to handle both HCL and JSON syntax, including legacy JSON format.

- Added comprehensive test cases for JSON provisioner parsing.

- Improved ExtractBuildProvisionerHCL to merge inline commands from shell provisioners.

- Enhanced logging for enforced block operations in HCP Packer.

* Remove PublishEnforcedBlocks function from Bucket struct

* Remove ExtractBuildProvisionerHCL function and unused imports

* Reverted the version upgrade

* Added the internal-sdk for the enforcedProvsioner api changes

* Enhance enforced provisioner handling and error reporting

- Update error handling in FetchEnforcedBlocks to return detailed errors instead of warnings.
- Modify GetCoreBuildProvisionerFromBlock to accept build name for overrides.
- Add tests for FetchEnforcedBlocks to ensure correct behavior and error handling.
- Implement diagnostics for unsupported legacy JSON templates.

* Implement enforced provisioner parsing and handling

- Introduced a new package `enforcedparser` to handle parsing of enforced provisioner blocks from HCL and JSON formats.

- Refactored existing code to utilize the new `ParseProvisionerBlocks` function from the `enforcedparser` package.

- Updated `GetCoreBuildProvisionerFromEnforcedBlock` method to convert enforced provisioner blocks into core build provisioners.

- Enhanced error handling and logging during the parsing process.

- Added tests for the new parsing functionality and ensured existing tests were updated to reflect changes.

- Modified `InjectEnforcedProvisioners` method in JSON registry to utilize the new parsing logic.

* Add test case for -skip-enforcement flag in BuildArgs

* Refactor sensitive variable handling in provisioners and add related tests

* Refactor enforced provisioner handling: remove internal parser, update tests, and streamline API interactions

* Enhance provisioner block parsing: add error handling for invalid combinations and expand test coverage

* Remove internal SDK replacement for enforced block types in go.mod

* Update dependencies in go.mod and go.sum: bump hcp-sdk-go and packer-plugin-sdk versions, adjust syft version, and update OpenTelemetry packages

* Update hcp-sdk-go dependency to v0.172.0 in go.mod and go.sum

* Fix formatting in TestBuildCommand_ParseArgs and add newline at end of json_enforced_test.go

* Refactor testJSONRegistryWithBuilds: remove environment variable setup and streamline registry initialization

* Rename injected variable for clarity in InjectEnforcedProvisioners function

---------

Co-authored-by: Hari Om <58305594+Madhav008@users.noreply.github.com>
2026-04-17 14:17:28 +05:30
.github docs: remove docs validation from packer (#13577) 2026-03-25 21:29:13 +05:30
.release [COMPLIANCE] Update Copyright and License Headers 2025-11-30 18:32:15 +00:00
acctest [COMPLIANCE] Update Copyright and License Headers (Batch 1 of 5) 2025-12-11 07:02:12 +00:00
builder [COMPLIANCE] Update Copyright and License Headers (Batch 1 of 5) 2025-12-11 07:02:12 +00:00
cmd [COMPLIANCE] Update Copyright and License Headers (Batch 1 of 5) 2025-12-11 07:02:12 +00:00
command Feature/enforced provisioner (#13591) 2026-04-17 14:17:28 +05:30
contrib/zsh-completion Update fix command autocomplete to work for JSON template files only (#12366) 2023-04-14 13:00:24 -04:00
datasource [COMPLIANCE] Update Copyright and License Headers (Batch 1 of 5) 2025-12-11 07:02:12 +00:00
examples Fixes typos in docs (#11322) 2021-10-11 10:19:49 +02:00
fix Merge pull request #13545 from hashicorp/compliance/update-headers-batch-2 2025-12-22 15:35:05 +05:30
hcl2template Feature/enforced provisioner (#13591) 2026-04-17 14:17:28 +05:30
helper [COMPLIANCE] Update Copyright and License Headers (Batch 2 of 5) 2025-12-11 07:02:15 +00:00
internal Feature/enforced provisioner (#13591) 2026-04-17 14:17:28 +05:30
packer Feature/enforced provisioner (#13591) 2026-04-17 14:17:28 +05:30
packer_test Merge pull request #13606 from hashicorp/dependabot/go_modules/packer_test/common/plugin_tester/go.opentelemetry.io/otel/sdk-1.43.0 2026-04-17 11:35:27 +05:30
post-processor [COMPLIANCE] Update Copyright and License Headers (Batch 3 of 5) 2025-12-11 07:02:12 +00:00
provisioner fix: exclude syft dependency import on NetBSD, OpenBSD, and Solaris (#13578) 2026-03-26 10:09:45 +05:30
scripts [COMPLIANCE] Update Copyright and License Headers (Batch 3 of 5) 2025-12-11 07:02:12 +00:00
version cut release v1.15.1 (#13588) 2026-03-26 16:44:34 +05:30
website Merge pull request #13532 from hashicorp/channel-assignment 2025-12-15 12:27:51 +05:30
.copywrite.hcl update year in license files 2023-12-06 12:43:42 -08:00
.gitattributes HCL2: add templatefile function (#10776) 2021-03-23 12:02:05 +01:00
.gitignore Remove the vendor dir (#10916) 2021-04-21 10:52:55 +02:00
.go-version bump syft to v1.42.3 (#13581) 2026-03-26 11:05:04 +05:30
.golangci.yml feat: native sbom generation for hcp (#13566) 2026-03-25 11:33:00 +05:30
background_check.go [COMPLIANCE] Update Copyright and License Headers (Batch 1 of 5) 2025-12-11 07:02:12 +00:00
background_check_openbsd.go [COMPLIANCE] Update Copyright and License Headers (Batch 1 of 5) 2025-12-11 07:02:12 +00:00
CHANGELOG.md cut release v1.15.1 (#13588) 2026-03-26 16:44:34 +05:30
checkpoint.go [COMPLIANCE] Update Copyright and License Headers (Batch 1 of 5) 2025-12-11 07:02:12 +00:00
CODEOWNERS add access to redirects and readme 2025-02-06 10:32:32 -08:00
commands.go [COMPLIANCE] Update Copyright and License Headers (Batch 1 of 5) 2025-12-11 07:02:12 +00:00
config.go [COMPLIANCE] Update Copyright and License Headers (Batch 1 of 5) 2025-12-11 07:02:12 +00:00
config_test.go [COMPLIANCE] Update Copyright and License Headers (Batch 1 of 5) 2025-12-11 07:02:12 +00:00
Dockerfile Merge pull request #13442 from hashicorp/anshul/docker_img_official_plugin 2026-01-28 10:04:33 +05:30
go Bump Go tooling version to 1.20.8 2023-10-03 10:32:42 -04:00
go.mod Feature/enforced provisioner (#13591) 2026-04-17 14:17:28 +05:30
go.sum Feature/enforced provisioner (#13591) 2026-04-17 14:17:28 +05:30
LICENSE Update LICENSE 2026-03-11 11:50:07 +05:30
log.go [COMPLIANCE] Update Copyright and License Headers (Batch 2 of 5) 2025-12-11 07:02:15 +00:00
main.go [COMPLIANCE] Update Copyright and License Headers (Batch 2 of 5) 2025-12-11 07:02:15 +00:00
main_test.go [COMPLIANCE] Update Copyright and License Headers (Batch 2 of 5) 2025-12-11 07:02:15 +00:00
Makefile docs: remove docs validation from packer (#13577) 2026-03-25 21:29:13 +05:30
panic.go [COMPLIANCE] Update Copyright and License Headers (Batch 3 of 5) 2025-12-11 07:02:12 +00:00
README.md docs: remove docs validation from packer (#13577) 2026-03-25 21:29:13 +05:30
tty.go [COMPLIANCE] Update Copyright and License Headers (Batch 3 of 5) 2025-12-11 07:02:12 +00:00
tty_solaris.go [COMPLIANCE] Update Copyright and License Headers (Batch 3 of 5) 2025-12-11 07:02:12 +00:00
Vagrantfile vagrantfile: add support for docker provider 2018-10-31 16:58:06 +03:00

Packer

License: BUSL-1.1 Build Status Discuss

HashiCorp Packer logo

Packer is a tool for building identical machine images for multiple platforms from a single source configuration.

Packer is lightweight, runs on every major operating system, and is highly performant, creating machine images for multiple platforms in parallel. Packer supports various platforms through external plugin integrations, the full list of which can be found at https://developer.hashicorp.com/packer/integrations.

The images that Packer creates can easily be turned into Vagrant boxes.

Quick Start

Packer

There is a great introduction and getting started guide for building a Docker image on your local machine without using any paid cloud resources.

Alternatively, you can refer to getting started with AWS to learn how to build a machine image for an external cloud provider.

HCP Packer

HCP Packer registry stores Packer image metadata, enabling you to track your image lifecycle.

To get started with building an AWS machine image to HCP Packer for referencing in Terraform refer to the collection of HCP Packer Tutorials.

Documentation

Comprehensive documentation is viewable on the Packer website at https://developer.hashicorp.com/packer/docs.

Contributing to Packer

See CONTRIBUTING.md for best practices and instructions on setting up your development environment to work on Packer.

Contributing to Documentation

Important: Packer documentation has moved to the hashicorp/web-unified-docs repository.

To contribute documentation changes:

Unmaintained Plugins

As contributors' circumstances change, development on a community maintained plugin can slow. When this happens, HashiCorp may use GitHub's option to archive the plugins repository, to clearly signal the plugin's status to users.

What does unmaintained mean?

  1. The code repository and all commit history will still be available.
  2. Documentation will remain on the Packer website.
  3. Issues and pull requests are monitored as a best effort.
  4. No active development will be performed by HashiCorp.

If you are interested in maintaining an unmaintained or archived plugin, please reach out to us at packer@hashicorp.com.