packer: the Shared Gallery Image to which to publish the managed image version to does not exist in the resource group

Zebee Johnstone 0 Reputation points
2023-05-10T02:22:03.07+00:00

I have created a resource group which is owned by the packer service principal

in there is an image gallery also owned by the packer service principal.

In there is an image definition and yes, also owned by the packer service principal. These were all created by terraform.

In the portal we have:

soe-rhel8-raw (gitnonprdinfra_images/soe-rhel8-raw) VM image definition Australia East

in the packer template the vm is created in a different resource group and published to the shared image gallery in the rg I created

variables:

"image_name": "soe-rhel8-raw",

"resource_group": "tg-packer-test-rg",

build:

  "builders": [{
            "type": "azure-arm",
            "client_id": "{{user `client_id`}}",
            "client_secret": "{{user `client_secret`}}",
            "subscription_id": "{{user `subscription_id`}}",
            "os_type": "Linux",
            "image_publisher": "redhat",
            "image_offer": "rhel-raw",
            "image_sku": "86-gen2",
            "image_version": "latest",
            "managed_image_name": "{{user `image_name`}}",
            "managed_image_resource_group_name": "{{user `resource_group`}}",
            "shared_image_gallery_destination":
            {
                "subscription": "{{user `subscription_id`}}",
                "resource_group": "rg-git-ti-dev-images-ae",
                "gallery_name": "gitnonprdinfra_images",
                "image_name": "soe-rhel-8-raw",
                "image_version": "2.0",
                "replication_regions": "{{user `location`}}",
                "storage_account_type": "Standard_LRS"
            }

there's more in the build such as provisioners but it doesn't get that far

it says

the Shared Gallery Image to which to publish the managed image version to does not exist in the resource group rg-git-ti-dev-images-ae

but I can see that image in the gallery. so what is going on?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
5,295 questions
{count} votes