0
votes

Receiving an error when creating a AzureRM VM with a Marketplace Image and Managed Disk, I am missing something syntax ally, maybe a plan block {} how would one find information to put in Plan block ? - Does anyone have a working example of a managed disk based AzureRM VM using a 3rd Party Marketplace image from Azure in Terraform ?

Error applying plan:

1 error(s) occurred:

* azurerm_virtual_machine.VMns-vpx-1: 1 error(s) occurred:

* azurerm_virtual_machine.VMns-vpx-1: compute.VirtualMachinesClient#CreateOrUpdate: Failure sending request: StatusCode=200 -- Original Error: Long running operation terminated with status 'Failed': Code="VMMarketplaceInvalidInput" Message="Creating a virtual machine fro
m Marketplace image requires Plan information in the request. OS disk name is 'myosdisk1'."

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.
PS C:\Users\eagle\Downloads\citrix\testingvpx>

In Addition Azure portal shows an error around the OS Disk:

General
Provisioning state Provisioning failed. Creating a virtual machine from Marketplace image requires Plan information in the request. OS disk name is 'myosdisk1'.. VMMarketplaceInvalidInput 
Guest agent Unknown 

Disks
myosdisk1 Provisioning failed. Creating a virtual machine from Marketplace image requires Plan information in the request. OS disk name is 'myosdisk1'.. VMMarketplaceInvalidInput

Terraform script being used:

resource "azurerm_virtual_machine" "VMns-vpx-1" {
  name                  = "VMns-vpx-1"
  location              = "${var.azu_location}"
  resource_group_name   = "${azurerm_resource_group.rgVMns-vpx.name}"
  network_interface_ids = ["${azurerm_network_interface.VMns-vpx-1-nic.id}"]
  vm_size               = "Standard_DS3_v2"

  storage_image_reference {
    publisher = "citrix"
    offer     = "netscalervpx120"
    sku       = "netscalerbyol"
    version   = "latest"
  }

  storage_os_disk {
    name              = "myosdisk1"
    caching           = "ReadWrite"
    create_option     = "FromImage"
    managed_disk_type = "Premium_LRS"
  }

  os_profile {
    computer_name  = ""
    admin_username = ""
    admin_password = ""
  }

  boot_diagnostics {
      enabled       = "true"
      storage_uri   = "${azurerm_storage_account.xxxx.primary_blob_endpoint}"
  }

  tags {
        Name = "xxxx"
        Service = "xxx"
  }
}
1

1 Answers

0
votes

just like it says, you are missing a "plan" property definition. Marketplace images tend to have that.

Everything else in the vm definition looks fine, unless Terraform needs something else.