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

Read labels into the data source, and regenerate code. #11320

Merged
merged 1 commit into from
Oct 11, 2021

Conversation

SwampDragons
Copy link
Contributor

This allows users to read labels off the data source. This could be important when labels confer important contextual information about the build, like vsphere datastores.

Example usage:

data "hcp-packer-iteration" "vanilla-prod" {
  bucket_name = "vsphere-ubuntu-18"
  channel     = "test-megan"
}

data "hcp-packer-image" "vanilla-aws" {
  bucket_name    = "vsphere-ubuntu-18"
  iteration_id   = data.hcp-packer-iteration.vanilla-prod.id
  cloud_provider = "vsphere"
  region         = "Black Mesa"
}

source "null" "printvals" {
  communicator = "none"
}

build {
  sources = ["source.null.printvals"]

  provisioner "shell-local" {
    inline = ["echo ${data.hcp-packer-image.vanilla-aws.labels["annotation"]}"]
  }
}

@SwampDragons SwampDragons requested a review from a team as a code owner October 8, 2021 23:00
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.

LGTM

Copy link
Member

@sylviamoss sylviamoss left a comment

Choose a reason for hiding this comment

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

Nice! 👍🏼

@SwampDragons SwampDragons merged commit 8df61bc into master Oct 11, 2021
@azr azr deleted the data_source_return_labels branch October 12, 2021 07:42
@github-actions
Copy link

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 Nov 12, 2021
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.

None yet

3 participants