I feel like I am doing something wrong here but I’m not sure what.
I have created a shared image gallery, and a few shared images with Terraform, and am using Packer to create shared image versions.
In packer I have the following defined:
managed_image_name : The name matching the shared image I created with Terraform (azurerm_shared_image.concourse.name)
shared_image_gallery_destination.image_name : Same as above
shared_image_gallery_destination.version: Some number I increment with each build, e.g. 18.4.1
Whenever I increment the version and build a new image I have to use -force because of the following error:
Build ‘azure-arm’ errored: the managed image named Concourse already exists in the resource group packer, use the -force option to automatically delete it.
Am I doing something misguided here, or is that the expected behavior with shared image versions?
managed_image_resource_group_name (string) - Specify the managed image resource group name where the result of the Packer build will be saved. The resource group must already exist. If this value is set, the value managed_image_name must also be set. See documentation to learn more about managed images.
managed_image_name (string) - Specify the managed image name where the result of the Packer build will be saved. The image name must not exist ahead of time, and will not be overwritten. If this value is set, the value managed_image_resource_group_name must also be set. See documentation to learn more about managed images.
I believe are aimed at creating a managed_image_name outside your gallery. Since your gallery already has a managed image defined in it. The redundancy says I have to -force or delete existing images you may have in your gallery.