packer-plugin-azure
packer-plugin-azure copied to clipboard
Feature Request: Azure Shared Image Gallery - Image definition created as part of builder
This issue was originally opened by @Marcus-James-Adams as hashicorp/packer#8803. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.
Following on from https://github.com/hashicorp/packer/issues/7809
Packer should be self-contained and be able to do everything required within a builder without outside assistance.
currently, we have to do the following before running packer
Use az cli or PowerShell to create a shared image definition, e.g. for a customised Ubuntu 18.04-LTS image: az sig image-definition create --resource-group
--gallery-name <my_shared_image_gallery> --gallery-image-definition --publisher --offer UbuntuServer --sku 18.04-LTS --os-type linux
It would be good if packer could create the definition automatically as part of the builder process.
I also had to add the hyper-v generation, or you might get a generation mis-match:
az sig image-definition create --resource-group <resource_group_name> --gallery-name <my_shared_image_gallery> --gallery-image-definition <gallery_image_definition> --publisher OpenLogic --offer CentOS --sku 7_9-gen2 --os-type linux --hyper-v-generation V2
I have the same issue, Azure Image Galleries have a poor versioning system allowing only major.minor.patch versioning.
When building from branches, or using different flavors for the image (different version of the app installed on the image), I want to leverage the image name to have a rich versioning.
But Packer Azure plugin does not create the Gallery Image Definition when it does not exist (it fails with a 404), which is super annoying.
This would be a P0 feature for me as for now this will require to add Azure CLI commands to create the Gallery Image Definition before Packer runs (and if the build fails it would let the Gallery in a messy situation)