diff --git a/builtin/providers/azurerm/resource_arm_virtual_machine.go b/builtin/providers/azurerm/resource_arm_virtual_machine.go index 5467967af..e3fe29808 100644 --- a/builtin/providers/azurerm/resource_arm_virtual_machine.go +++ b/builtin/providers/azurerm/resource_arm_virtual_machine.go @@ -1317,6 +1317,14 @@ func expandAzureRmVirtualMachineDataDisk(d *schema.ResourceData) ([]compute.Data data_disk.ManagedDisk = managedDisk } + //BEGIN: code to be removed after GH-13016 is merged + if vhdURI != "" && managedDiskID != "" { + return nil, fmt.Errorf("[ERROR] Conflict between `vhd_uri` and `managed_disk_id` (only one or the other can be used)") + } + if vhdURI != "" && managedDiskType != "" { + return nil, fmt.Errorf("[ERROR] Conflict between `vhd_uri` and `managed_disk_type` (only one or the other can be used)") + } + //END: code to be removed after GH-13016 is merged if managedDiskID == "" && strings.EqualFold(string(data_disk.CreateOption), string(compute.Attach)) { return nil, fmt.Errorf("[ERROR] Must specify which disk to attach") } @@ -1434,6 +1442,14 @@ func expandAzureRmVirtualMachineOsDisk(d *schema.ResourceData) (*compute.OSDisk, osDisk.ManagedDisk = managedDisk } + //BEGIN: code to be removed after GH-13016 is merged + if vhdURI != "" && managedDiskID != "" { + return nil, fmt.Errorf("[ERROR] Conflict between `vhd_uri` and `managed_disk_id` (only one or the other can be used)") + } + if vhdURI != "" && managedDiskType != "" { + return nil, fmt.Errorf("[ERROR] Conflict between `vhd_uri` and `managed_disk_type` (only one or the other can be used)") + } + //END: code to be removed after GH-13016 is merged if managedDiskID == "" && strings.EqualFold(string(osDisk.CreateOption), string(compute.Attach)) { return nil, fmt.Errorf("[ERROR] Must specify which disk to attach") } diff --git a/builtin/providers/azurerm/resource_arm_virtual_machine_test.go b/builtin/providers/azurerm/resource_arm_virtual_machine_test.go index 3593316b5..71552b8cf 100644 --- a/builtin/providers/azurerm/resource_arm_virtual_machine_test.go +++ b/builtin/providers/azurerm/resource_arm_virtual_machine_test.go @@ -611,7 +611,9 @@ func TestAccAzureRMVirtualMachine_osDiskTypeConflict(t *testing.T) { Steps: []resource.TestStep{ { Config: config, - ExpectError: regexp.MustCompile("conflicts with storage_os_disk.0.vhd_uri"), + ExpectError: regexp.MustCompile("Conflict between `vhd_uri`"), + //Use below code instead once GH-13019 has been merged + //ExpectError: regexp.MustCompile("conflicts with storage_os_disk.0.vhd_uri"), }, }, }) @@ -627,7 +629,9 @@ func TestAccAzureRMVirtualMachine_dataDiskTypeConflict(t *testing.T) { Steps: []resource.TestStep{ { Config: config, - ExpectError: regexp.MustCompile("conflicts with storage_data_disk.1.vhd_uri"), + ExpectError: regexp.MustCompile("Conflict between `vhd_uri`"), + //Use below code instead once GH-13019 has been merged + //ExpectError: regexp.MustCompile("conflicts with storage_data_disk.1.vhd_uri"), }, }, })