hashicorp / hashicorp/packer

Set packer cli options from environment variables

Open
#11,498 0 comments 3 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](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request.
Please do not leave "+1" or "me too" comments, 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.

#### Description

I would like to be able to set options for packer commands from environment variables. I realize this is possible for input variables, using `PKR_VAR_`. But it does not seem possible for arguments to the cli itself, such as `-only` and `-except`. For example, terraform allows this using [TF_CLI_ARGS and TF_CLI_ARGS_name](https://www.terraform.io/cli/config/environment-variables#tf_cli_args-and-tf_cli_args_name).

Generally, I would expect the env value to be used as a default, and args provided directly on the cli to override the same option from the env.

#### Potential References

* [Terraform TF_CLI_ARGS and TF_CLI_ARGS_name](https://www.terraform.io/cli/config/environment-variables#tf_cli_args-and-tf_cli_args_name)

Contributor guide

Open the contributing guide

Research direction

The issue names no files or tests; begin at Packer's CLI command parsing for -only and -except and compare the referenced Terraform TF_CLI_ARGS behavior. Done means environment variables provide defaults for command options while explicitly supplied CLI arguments override the same option, with coverage for both forms.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.