hashicorp / packer-plugin-azure

Packer plugin for Azure Virtual Machine Image Builders
https://www.packer.io/docs/builders/azure
Mozilla Public License 2.0
47 stars 76 forks source link

Fix panic when encrypted images or using security type with a Shared Image Gallery source #407

Closed JenGoldstrich closed 2 months ago

JenGoldstrich commented 2 months ago

Previously we weren't instantiating the managed image object inside the template factory whenever a build used a SIG image as a source, (i.e. had a shared_image_gallery block set), this would cause a panic when setting a disk encryption set ID, and as of v2.0.5. it would also cause a similar panic when trying to set the encryption type. To verify this I went back to version 2.0.0 and also reproduced a panic when setting a disk encryption set ID with a shared_image_gallery block as the source image

To fix this I just added nullchecks and instantiate where relevant, I ran acceptance tests on this PR

Closes #406