I created a custom image which has one OS disk and one data disk.
resource “azurerm_image” “saplinux” {
name = “TEST”
location = “eastus”
resource_group_name = “rg-eus-prod-001”
os_disk {
os_type = "Linux"
os_state = "Generalized"
caching = "ReadWrite"
blob_uri = "https://xxxx/vhds/A0DFOF44RHE076-1.vhd"
size_gb = 27
}
data_disk {
blob_uri = "https://xxx/vhds/A0DFOF44RHE076-2.vhd"
caching = "ReadWrite"
size_gb = 23
lun = 0
}
}
I use “source_image_id” to refer to this image
source_image_id = azurerm_image.saplinux.id
But when I ran “terraform apply”, I got this error:
Error: Error creating Linux Virtual Machine “vma0dfeustest001” (Resource Group “rg-a0df-eus-prod-001”): compute.VirtualMachinesClient#CreateOrUpdate: Failure sending request: StatusCode=400 – Original Error: Code=“InvalidParameter” Message=“StorageProfile.dataDisks.lun does not have required value(s) for image specified in storage profile.” Target=“storageProfile”
Custom image is created successfully, any idea about this error?