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 a property for the full gallery ID to the shared_image_gallery block #431

Open
danbarr opened this issue Jul 10, 2024 · 0 comments
Open

Comments

@danbarr
Copy link

danbarr commented Jul 10, 2024

Community Note

Please vote on this issue by adding a 👍 reaction 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

Currently, the shared_image_gallery block has individual properties for the elements of an Azure Compute Gallery's ID: subscription, resource_group, gallery_name, image_name, image_version.

But when referencing a source/parent image from HCP Packer, the hcp-packer-artifact data source's external_identifier returns the full ID string, /subscriptions/<id>/resourceGroups/<name>/providers/Microsoft.Compute/galleries/<name>/images/<name>/versions/<version>

This means we have to do some nasty & fragile string parsing to pull out the individual components, or use the build labels from the HCP Packer artifact like this:

  # Source image
  shared_image_gallery {
    subscription   = var.az_subscription_id
    resource_group = data.hcp-packer-artifact.example.labels.sig_resource_group
    gallery_name   = data.hcp-packer-artifact.example.labels.sig_name
    image_name     = data.hcp-packer-artifact.example.labels.sig_image_name
    image_version  = data.hcp-packer-artifact.example.labels.sig_image_version
  }

Propose the addition of a shared_image_gallery_id attribute which can be used in lieu of the five individual attributes, similar to the existing community_gallery_image_id and direct_shared_gallery_image_id attributes.

Use Case(s)

Integrating with HCP Packer to resolve a source image that is located in a Compute Gallery.

Potential configuration

  # Source image
  shared_image_gallery {
    shared_image_gallery_id = data.hcp-packer-artifact.example.external_identifier
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant