Skip to content

Add support to include tags information in data source outputs聽#804

Description

@9numbernine9

Code of Conduct

  • I have read and agree to the project's Code of Conduct.
  • Vote on this issue by adding a 馃憤 reaction to the original issue description to help the maintainers prioritize.
  • Do not leave "+1" or other comments that do not add relevant information or questions.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Description

Hello!

I'm excited to see the work for tag support in data sources that was released as part of #196 . Now that it has been released, I have a feature request: would it be possible to include tag information on the outputs of the data sources?

In our use case, we have essentially a "chain" of Packer images that are being built: a 'base' template image gets built, then that template is consumed by other downstream images, and those images are further consumed by other images, etc. It would be very useful to be able to discover the tags on any of the original input images so that they could be propagated forward to the further downstream images. (Essentially, this would allow "inheritance" of tag information on a case-by-case basis.)

Use Case(s)

To allow the usage of tags that were retrieved from a data source when building an image with vsphere-clone (e.g.).

Potential Configuration

Something like the following, based on existing examples in the docs. (Note that this is probably not syntactically correct but I think it gets the point across.)

data "vsphere-content-library-item" "iso" {
  vcenter_server  = "vc01.example.com"
  username        = "administrator@vsphere.local"
  password        = "VMware1!"
  datacenter      = "dc-01"
  content_library = "lib01"
  name            = "linux-debian-13*-amd64"
  type            = "iso"
  tag {
    category = "environment"
    name     = "production"
  }
}

source "vsphere-clone" "example" {
  vcenter_server = "vc01.example.com"
  username       = "administrator@vsphere.local"
  password       = "VMware1!"
  host           = "esx01.example.com"
  iso_paths      = [data.vsphere-content-library-item.iso.path]

  dynamic "tag" {
    # Not currently possible - feature request here!
    for_each = data.vsphere-content-library-item.iso.tags

    content {
      category = tag.category
      name     = tag.name
    }
  }

 # Then my image can be further enhanced with my own tags here
  tag {
    category = "my-category"
    name      = "my-name"
  }
}

build {
  sources = ["source.vsphere-clone.example"]
}

References

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions