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

Deploying Marketplace Azure Image with plan_info fails to populate information #12616

Open
E0482204 opened this issue Sep 1, 2023 · 1 comment
Labels

Comments

@E0482204
Copy link

E0482204 commented Sep 1, 2023

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 other comments that do not add relevant new information or questions, 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

Overview of the Issue

When supplying a simple packer template including plan information as documented , the image is deployed, however the plan information does not propagate to the final image. This results in Azure erroring about plan information being required when trying to create a VM from the image.

Reproduction Steps

  1. Run packer build for the template below
  2. View Image definition JSON in Azure and observe lack of "plan" information on the resource.

Packer version

1.9.4

Simplified Packer Template

source "azure-arm" "ubuntu-pro-22-04" {
  azure_tags = {
  }
  client_id                         = var.arm_client_id
  client_secret                     = var.arm_client_secret
  subscription_id                   = var.arm_subscription_id
  image_offer                       = "0001-com-ubuntu-pro-jammy"
  image_publisher                   = "canonical"
  image_sku                         = "pro-22_04-lts-gen2"
  location                          = "East US"
  managed_image_name                = "Test_Hardened_Ubuntu_Pro_Packer"
  managed_image_resource_group_name = var.azure_resource_group
  os_type                           = "Linux"
  ssh_read_write_timeout            = "5m" #Allow Reboots  https://github.com/hashicorp/packer/issues/11190

  plan_info {
    plan_name      = "pro-22_04-lts-gen2"
    plan_publisher = "canonical"
    plan_product   = "0001-com-ubuntu-pro-jammy"
  }
  
 # tenant_id                         = "72f988bf-86f1-41af-91ab-2d7cd011db47"
  vm_size                           = "Standard_DS2_v2"
}

Operating system and Environment details

Ubuntu 22.04

Resulting Image JSON

{
    "name": "Eaton_Ubuntu_Pro_22_04-lts",
    "id": "/subscriptions/a62ae09c-9c19-43db-a247-809824dead2d/resourceGroups/OS_Images_RG/providers/Microsoft.Compute/galleries/sigy8b6/images/Eaton_Ubuntu_Pro_22_04-lts",
    "type": "Microsoft.Compute/galleries/images",
    "location": "eastus",
    "tags": {},
    "properties": {
        "hyperVGeneration": "V1",
        "architecture": "x64",
        "osType": "Linux",
        "osState": "Generalized",
        "identifier": {
            "publisher": "canonical",
            "offer": "0001-com-ubuntu-pro-jammy",
            "sku": "pro-22_04-lts"
        },
        "recommended": {
            "vCPUs": {
                "min": 1,
                "max": 4
            },
            "memory": {
                "min": 1,
                "max": 8
            }
        },
        "provisioningState": "Succeeded"
    }
}

Log Fragments and crash.log files

[...]
==> azure-arm.ubuntu-pro-22-04: Running builder ...
    azure-arm.ubuntu-pro-22-04: Creating Azure Resource Manager (ARM) client ...
==> azure-arm.ubuntu-pro-22-04: the managed image named Test_Hardened_Ubuntu_Pro_Packer already exists, but deleting it due to -force flag
==> azure-arm.ubuntu-pro-[22](https://github.com/etn-corp/ETN-IT-Operating-Systems/actions/runs/6051208759/job/16422155034#step:9:23)-04: Getting source image id for the deployment ...
==> azure-arm.ubuntu-pro-22-04:  -> SourceImageName: '/subscriptions/***/providers/Microsoft.Compute/locations/East US/publishers/canonical/ArtifactTypes/vmimage/offers/0001-com-ubuntu-pro-jammy/skus/pro-22_04-lts-gen2/versions/latest'
==> azure-arm.ubuntu-pro-22-04: Creating resource group ...
==> azure-arm.ubuntu-pro-22-04:  -> ResourceGroupName : 'pkr-Resource-Group-74m0j37a8r'
==> azure-arm.ubuntu-pro-22-04:  -> Location          : 'East US'
==> azure-arm.ubuntu-pro-22-04:  -> Tags              :
==> azure-arm.ubuntu-pro-22-04:  ->> PlanInfo : pro-22_04-lts-gen2
==> azure-arm.ubuntu-pro-22-04:  ->> PlanProduct : 0001-com-ubuntu-pro-jammy
==> azure-arm.ubuntu-pro-22-04:  ->> PlanPublisher : canonical
==> azure-arm.ubuntu-pro-22-04:  ->> PlanPromotionCode :
==> azure-arm.ubuntu-pro-22-04: Validating deployment template ...
[...]
==> azure-arm.ubuntu-pro-22-04: Powering off machine ...
==> azure-arm.ubuntu-pro-22-04:  -> ResourceGroupName : 'pkr-Resource-Group-74m0j37a8r'
==> azure-arm.ubuntu-pro-22-04:  -> ComputeName       : 'pkrvm74m0j37a8r'
==> azure-arm.ubuntu-pro-22-04:  -> Compute ResourceGroupName : 'pkr-Resource-Group-74m0j37a8r'
==> azure-arm.ubuntu-pro-22-04:  -> Compute Name              : 'pkrvm74m0j37a8r'
==> azure-arm.ubuntu-pro-22-04:  -> Compute Location          : 'East US'
==> azure-arm.ubuntu-pro-22-04: Generalizing machine ...
==> azure-arm.ubuntu-pro-22-04: Capturing image ...
==> azure-arm.ubuntu-pro-22-04:  -> Image ResourceGroupName   : 'OS_Images_RG'
==> azure-arm.ubuntu-pro-22-04:  -> Image Name                : 'Test_Hardened_Ubuntu_Pro_Packer'
==> azure-arm.ubuntu-pro-22-04:  -> Image Location            : 'East US'
==> azure-arm.ubuntu-pro-22-04: 
[...]
@ImpostorKeanu
Copy link

Experiencing the same thing.

Seems plan_info is used only for the base image, not when the new image is being registered in the gallery.

Introducing a plan_info field in shared_image_gallery_destination that then passes the information along would be nice if feasible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants