hashicorp / hashicorp/packer

Provide access to source variables for all plugins.

Open
#13,225 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](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 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

#### Description

These docs suggest that you can access variables defined on sources later in build blocks.
https://developer.hashicorp.com/packer/docs/templates/hcl_templates/blocks/source

But from all the examples in this discussion thread it appears you cannot do this with the amazon-ebs plugin.
https://discuss.hashicorp.com/t/packer-source-blocks-unable-to-validate-in-packer-1-11-2/71853/9

We cannot for example reference ssh_username in an ansible plugin provisioner which means we repeat ourselves.

It is also not possible to define extra source variables unless the plugin uses them. This would be very helpful. Currently the [documentation](https://developer.hashicorp.com/packer/docs/templates/hcl_templates/blocks/source) leads us to believe that these things are currently possible, but they are not.

#### Use Case(s)

To be able to reuse code without repe

#### Potential configuration

```
```

#### Potential References

Contributor guide

Open the contributing guide

Research direction

Start with the source-block documentation and the linked discussion about Packer 1.11.2 validation, then compare amazon-ebs source variables with their use in an Ansible provisioner. Done means source variables and additional source-defined variables are consistently accessible across plugins, or the documentation clearly states the supported limits.

Written by the indexing model from the issue text.

Assessment

Tech stack
ansible, aws
Domain
devops, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.