hashicorp / hashicorp/packer

Enhance Builder Selection with Multi-Builder Filtering and Validation

Open
#13,537 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
15.8k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

#### Community Note

* Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
* Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
* If you are interested in working on this issue or have submitted a pull request, please leave a comment

Please search the existing issues for relevant feature requests, and use the
reaction feature to add upvotes to pre-existing requests.

#### Description

Currently, when working with multi-cloud or multi-builder Packer templates, users rely mainly on the `-only` flag to select specific builders. There is no native mechanism to filter builders by tags, metadata, or capabilities.
This makes large or modular templates harder to manage, especially in CI/CD environments where dynamic builder selection is needed.

This feature request proposes **Enhanced Builder Selection with Multi-Builder Filtering and Validation**, enabling tagging, metadata-based filtering, and improved visibility of which builders will execute.

#### Use Case(s)

* Large multi-cloud templates containing AWS, Azure, GCP, VMware, and Docker builders.
* CI/CD pipelines needing conditional builder execution (e.g., build only `prod` images).
* Modular templates where builder selection depends on architecture, region, or environment.
* Avoiding accidental builds on unwanted builders.
* Improving template maintainability and clarity by grouping related builders.

#### Potential configuration

```hcl
builders = [
{
type = "amazon-ebs"
tags = ["prod", "x86", "us-east"]
},
{
type = "azure-arm"
tags = ["dev", "x86"]
},
{
type = "googlecompute"
tags = ["prod", "arm64"]
}
]

# CLI usage examples:
# Select builders with matching tags:
packer build -filter="tags=prod,x86"

# Filter by custom metadata:
packer build -filter="region=us-east"

Contributor guide

Open the contributing guide

Research direction

The issue names the existing -only builder-selection flag but no files, tests, or entry points. Start by locating its implementation and related validation tests, then clarify the configuration syntax, filtering semantics, and validation behavior before defining what successful builder selection and visibility should look like.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.