mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-07-04 04:22:59 +00:00
Make disk interface a required attribute
This commit is contained in:
parent
328acd80df
commit
6a08bb7329
@ -463,7 +463,7 @@ func resourceVirtualEnvironmentVM() *schema.Resource {
|
|||||||
mkResourcevirtualEnvironmentVMDiskInterface: {
|
mkResourcevirtualEnvironmentVMDiskInterface: {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Description: "The datastore name",
|
Description: "The datastore name",
|
||||||
Optional: true,
|
Optional: false,
|
||||||
Default: dvResourcevirtualEnvironmentVMDiskInterface,
|
Default: dvResourcevirtualEnvironmentVMDiskInterface,
|
||||||
},
|
},
|
||||||
mkResourceVirtualEnvironmentVMDiskDatastoreID: {
|
mkResourceVirtualEnvironmentVMDiskDatastoreID: {
|
||||||
@ -1624,7 +1624,7 @@ func resourceVirtualEnvironmentVMCreateCustom(d *schema.ResourceData, m interfac
|
|||||||
createBody.VirtualIODevices = virtioDeviceObjects
|
createBody.VirtualIODevices = virtioDeviceObjects
|
||||||
}
|
}
|
||||||
|
|
||||||
//this will most likely break the cdrom part
|
//this will most likely break the cdrom part thats why ide is disabled in line 2017
|
||||||
/*
|
/*
|
||||||
if ideDevices != nil {
|
if ideDevices != nil {
|
||||||
createBody.IDEDevices = ideDeviceObjects
|
createBody.IDEDevices = ideDeviceObjects
|
||||||
@ -1993,7 +1993,6 @@ func resourceVirtualEnvironmentVMGetDiskDeviceObjects(d *schema.ResourceData, m
|
|||||||
diskDevice := d.Get(mkResourceVirtualEnvironmentVMDisk).([]interface{})
|
diskDevice := d.Get(mkResourceVirtualEnvironmentVMDisk).([]interface{})
|
||||||
diskDeviceObjects := make(map[string]map[string]proxmox.CustomStorageDevice)
|
diskDeviceObjects := make(map[string]map[string]proxmox.CustomStorageDevice)
|
||||||
resource := resourceVirtualEnvironmentVM()
|
resource := resourceVirtualEnvironmentVM()
|
||||||
scsiDefaultCount := 0
|
|
||||||
|
|
||||||
for _, diskEntry := range diskDevice {
|
for _, diskEntry := range diskDevice {
|
||||||
diskDevice := proxmox.CustomStorageDevice{
|
diskDevice := proxmox.CustomStorageDevice{
|
||||||
@ -2041,16 +2040,10 @@ func resourceVirtualEnvironmentVMGetDiskDeviceObjects(d *schema.ResourceData, m
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// only for backwards compatibility
|
|
||||||
if diskInterface == "" {
|
|
||||||
diskInterface = fmt.Sprintf("scsi%d", scsiDefaultCount)
|
|
||||||
scsiDefaultCount = scsiDefaultCount + 1
|
|
||||||
}
|
|
||||||
|
|
||||||
baseDiskInterface := diskDigitPrefix(diskInterface)
|
baseDiskInterface := diskDigitPrefix(diskInterface)
|
||||||
|
|
||||||
if baseDiskInterface != "virtio" && baseDiskInterface != "scsi" && baseDiskInterface != "sata" && baseDiskInterface != "ide" {
|
if baseDiskInterface != "virtio" && baseDiskInterface != "scsi" && baseDiskInterface != "sata" {
|
||||||
errorMsg := fmt.Sprintf("Defined disk interface not supported. Interface was %s, but only virtio, sata, scsi, and ide are supported", diskInterface)
|
errorMsg := fmt.Sprintf("Defined disk interface not supported. Interface was %s, but only virtio, sata and scsi are supported", diskInterface)
|
||||||
return diskDeviceObjects, errors.New(errorMsg)
|
return diskDeviceObjects, errors.New(errorMsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user