Skip to content

[AVM Module Issue]: VM provision failed with 'Plan required error' even though the image is owned by friend developer's gallery image #108

Open
@msjo66

Description

@msjo66

Check for previous/existing GitHub issues

  • I have checked for previous/existing GitHub issues

Issue Type?

I'm not sure

(Optional) Module Version

0.15.1

(Optional) Correlation Id

No response

Description

provider "azurerm" {
  features {
  }
}

provider "azurerm" {
  features{}
  alias  = "for_gallery"
  subscription_id = "64061f25-366b-47a8-af8b-74a88656fbb2"
  # client_id = "${var.client_id}"
  # client_secret = "${var.client_secret}"
  # tenant_id = "${var.tenant_id}"
}

data "azurerm_client_config" "current" {}

data "azurerm_shared_image" "example" {
  name                = "image-rocky8.10-240820"
  gallery_name        = "cg_az01_co013601_01"
  resource_group_name = "rg-az01-co013601-azgov-infra-01"

  provider = "azurerm.for_gallery"  
}

resource "azurerm_marketplace_agreement" "barracuda" {
  publisher = "barracudanetworks"
  offer     = "waf"
  plan      = "hourly"

      name      = "8-base"
    product   = "resf"
    publisher = "rockylinux-x86_64"
}

module "this" {
  #source = "../../"
  source = "Azure/avm-res-compute-virtualmachine/azurerm"
  #version = "0.15.1"

  location            = var.base-info.location
  resource_group_name = var.base-info.rg_name
  os_type             = var.vm-info.os_type
  name                = var.vm-info.name
  sku_size            = var.vm-info.sku_size
  zone                = var.vm-info.zone

  admin_username                     = var.vm-info.admin_username
  admin_password                     = var.vm-info.admin_password
  disable_password_authentication    = var.vm-info.disable_password_authentication
  enable_telemetry                   = var.vm-info.enable_telemetry
  encryption_at_host_enabled         = var.vm-info.encryption_at_host_enabled
  generate_admin_password_or_ssh_key = var.vm-info.generate_admin_password_or_ssh_key


  source_image_resource_id = data.azurerm_shared_image.example.id
  # source_image_reference = {
  #   publisher = "myeong.lee"
  #   offer     = "rocky8.10"
  #   sku       = "rocky8.10"
  #   version   = "1.0.0"
  # }
  
  # source_image_reference = {
  #   publisher = var.vm-info.source_image_reference.publisher
  #   offer     = var.vm-info.source_image_reference.offer
  #   sku       = var.vm-info.source_image_reference.sku
  #   version   = var.vm-info.source_image_reference.version
  # }

  os_disk = {
    caching = var.vm-info.os_disk.caching
    storage_account_type = var.vm-info.os_disk.storage_account_type
    name = var.vm-info.os_disk.name
    disk_size_gb              = var.vm-info.os_disk.disk_size_gb
    write_accelerator_enabled = var.vm-info.os_disk.write_accelerator_enabled
  }

  # data_disk_managed_disks = {
  #   disk1 = {
  #       name                 = "my-vm01-data-disk01"
  #       storage_account_type = "Standard_LRS"
  #       lun                  = 0
  #       caching              = "ReadWrite"
  #       disk_size_gb         = 32
  #   }
  # }

  network_interfaces = {
    network_interface_1 = {
      ip_configurations = {
        ip_configuration_1 = {
          name                          = "${var.vm-info.nic_name}-ipconfig1"
          private_ip_subnet_resource_id = "/subscriptions/${data.azurerm_client_config.current.subscription_id}/resourceGroups/${var.base-info.rg_name}/providers/Microsoft.Network/virtualNetworks/${var.vnet-info.vnet_name}/subnets/${var.vnet-info.subnets.app.name}"
        }
      }
      name = var.vm-info.nic_name
    }
  }

}

I've tried to provision a VM with above HCL. but the following error log returns

"Creating a virtual machine from Marketplace image or a custom image sourced from a Marketplace image requires Plan information in the request. VM: '/subscriptions/675f8b56-b926-4138-b129-24cd4f406d38/resourceGroups/rg-az01-ag015701-prd-idt-01/providers/Microsoft.Compute/virtualMachines/vm-az01-prd-idt-was-01'."

the referenced image and the gallery is owned by my colleague(another team developer) and I have read permission. Same error returns with following plan argument. I can provision vm using portal and the following plan argument is in the ARM template of the successfully provisioned vm. Is 'plan' argument applied with 'source_image_resource_id' argument?

  plan = {
     name      = "8-base"
     product   = "resf"
     publisher = "rockylinux-x86_64"
   }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions