Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for variable interpolation to hcp_packer_registry and build blocks. #11421

Merged
merged 4 commits into from Dec 1, 2021

Conversation

nywilken
Copy link
Member

@nywilken nywilken commented Nov 29, 2021

  • This change allows for the use of variables for setting HCP Packer metadata.
    Users should be able to set variables either statically or dynamically via environment variables to set bucket_name, bucket_labels, and build_labels.

  • This change adds support for using variables within the base Packer build block - merged in from Add build block variable interpolation #11425

Closes #9794
Closes https://github.com/hashicorp/packer-internal-issues/issues/20

@@ -48,7 +48,7 @@ func (p *Parser) decodeHCPRegistry(block *hcl.Block) (*HCPPackerRegistryBlock, h
BuildLabels map[string]string `hcl:"build_labels,optional"`
Config hcl.Body `hcl:",remain"`
}
diags := gohcl.DecodeBody(body, nil, &b)
diags := gohcl.DecodeBody(body, cfg.EvalContext(BuildContext, nil), &b)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what I would've done ! 👍🏼

@nywilken nywilken force-pushed the hcp_packer_registry-variable-interpolation branch from 9bea722 to 8192c14 Compare November 30, 2021 16:50
@nywilken nywilken force-pushed the hcp_packer_registry-variable-interpolation branch from 8192c14 to d14649d Compare November 30, 2021 16:56
@nywilken nywilken marked this pull request as ready for review November 30, 2021 21:26
@nywilken nywilken requested a review from a team as a code owner November 30, 2021 21:26
@nywilken nywilken changed the title Add support for variable interpolation in hcp_packer_registry block Add support for variable interpolation to hcp_packer_registry and build blocks. Nov 30, 2021
@nywilken nywilken force-pushed the hcp_packer_registry-variable-interpolation branch from 8175f5c to 996cc9a Compare December 1, 2021 02:55
Copy link
Contributor

@azr azr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome ! LGTM

@azr azr merged commit 4a0fbd9 into master Dec 1, 2021
@azr azr deleted the hcp_packer_registry-variable-interpolation branch December 1, 2021 10:35
@github-actions
Copy link

github-actions bot commented Jan 1, 2022

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[HCL2] build block: name field should support variables/locals
2 participants