79093969

Date: 2024-10-16 12:16:50
Score: 2
Natty:
Report link

Deploy AlienVault USM from Azure Marketplace using Terraform

Hello Scott, seems like you already found a solution to your problem, I am just posting it here for ease of other folks who are facing similar issue on SO. Please feel free to add any points / your inputs to this if required.

What you mentioned in the comment is on track because if a vendor publishes a Marketplace image, they may specify certain plans that need to be associated with that image when they deployed it which in general happens in azurerm_virtual_machine& not included in your azurerm_linux_virtual_machine. Sometimes OS specifications can also be the issue for these cases.

I tried a demo terraform code as per suggestion such that it can be helpful for the community people who might try to provision the same image VM.

Configuration:

resource "azurerm_virtual_machine" "vm" {
  name                  = "usm-001"
  location              = azurerm_resource_group.rg.location
  resource_group_name   = azurerm_resource_group.rg.name
  network_interface_ids = [azurerm_network_interface.nic.id]
  vm_size               = "Standard_B2ms"

  storage_os_disk {
    name              = "usm-001-osdisk-001"
    caching           = "None"
    create_option     = "FromImage"
    managed_disk_type = "StandardSSD_LRS"
  }

  os_profile {
    computer_name  = "usm-001"
    admin_username = "xadmin"
    admin_password = "TerraPass11." 

  os_profile_linux_config {
    disable_password_authentication = false
  }

  storage_image_reference {
    publisher = "alienvault"
    offer     = "unified-security-management-anywhere"
    sku       = "unified-security-management-anywhere"
    version   = "latest"
  }
  
   plan {
    name      = "unified-security-management-anywhere"
    product   = "unified-security-management-anywhere"
    publisher = "alienvault"
  }
}


resource "azurerm_managed_disk" "data_disk" {
  name                 = "data-disk-001"
  location             = azurerm_resource_group.rg.location
  resource_group_name  = azurerm_resource_group.rg.name
  create_option        = "Empty"
  storage_account_type = "StandardSSD_LRS"
  disk_size_gb         = 50

  depends_on = [ azurerm_virtual_machine.vm ]
}

resource "azurerm_virtual_machine_data_disk_attachment" "data_disk_attach" {
  managed_disk_id    = azurerm_managed_disk.data_disk.id
  virtual_machine_id = azurerm_virtual_machine.vm.id
  lun                = 1  # Logical Unit Number for the data disk
  caching            = "None"
  depends_on = [ azurerm_virtual_machine.vm, azurerm_managed_disk.data_disk ]
}

Deployment:

enter image description here

enter image description here

enter image description here

Refer:

azurerm_virtual_machine | Resources | hashicorp/azurerm | Terraform | Terraform Registry

Reasons:
  • Probably link only (1):
  • Long answer (-1):
  • Has code block (-0.5):
  • Me too answer (2.5): facing similar issue
Posted by: Vinay B