mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-06-30 02:31:10 +00:00
fix(vm): allow to set machine
type in clone (#1865)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
This commit is contained in:
parent
4f522ec342
commit
7090b1036a
@ -714,6 +714,26 @@ func TestAccResourceVMClone(t *testing.T) {
|
||||
}
|
||||
}`, WithRootUser()),
|
||||
}}},
|
||||
{"clone machine type", []resource.TestStep{{
|
||||
Config: te.RenderConfig(`
|
||||
resource "proxmox_virtual_environment_vm" "template" {
|
||||
node_name = "{{.NodeName}}"
|
||||
started = false
|
||||
template = true
|
||||
machine = "q35"
|
||||
}
|
||||
resource "proxmox_virtual_environment_vm" "clone" {
|
||||
node_name = "{{.NodeName}}"
|
||||
started = false
|
||||
clone {
|
||||
vm_id = proxmox_virtual_environment_vm.template.vm_id
|
||||
}
|
||||
machine = "pc"
|
||||
}`),
|
||||
Check: ResourceAttributes("proxmox_virtual_environment_vm.clone", map[string]string{
|
||||
"machine": "pc",
|
||||
}),
|
||||
}}},
|
||||
{"clone no vga block", []resource.TestStep{{
|
||||
Config: te.RenderConfig(`
|
||||
resource "proxmox_virtual_environment_vm" "template" {
|
||||
|
@ -1898,26 +1898,27 @@ func vmCreateClone(ctx context.Context, d *schema.ResourceData, m interface{}) d
|
||||
}
|
||||
|
||||
// Now that the virtual machine has been cloned, we need to perform some modifications.
|
||||
acpi := types.CustomBool(d.Get(mkACPI).(bool))
|
||||
agent := d.Get(mkAgent).([]interface{})
|
||||
audioDevices := vmGetAudioDeviceList(d)
|
||||
|
||||
acpi := types.CustomBool(d.Get(mkACPI).(bool))
|
||||
agent := d.Get(mkAgent).([]interface{})
|
||||
bios := d.Get(mkBIOS).(string)
|
||||
kvmArguments := d.Get(mkKVMArguments).(string)
|
||||
scsiHardware := d.Get(mkSCSIHardware).(string)
|
||||
cdrom := d.Get(mkCDROM).([]interface{})
|
||||
cpu := d.Get(mkCPU).([]interface{})
|
||||
initialization := d.Get(mkInitialization).([]interface{})
|
||||
hostPCI := d.Get(mkHostPCI).([]interface{})
|
||||
hostUSB := d.Get(mkHostUSB).([]interface{})
|
||||
initialization := d.Get(mkInitialization).([]interface{})
|
||||
keyboardLayout := d.Get(mkKeyboardLayout).(string)
|
||||
kvmArguments := d.Get(mkKVMArguments).(string)
|
||||
machine := d.Get(mkMachine).(string)
|
||||
memory := d.Get(mkMemory).([]interface{})
|
||||
numa := d.Get(mkNUMA).([]interface{})
|
||||
operatingSystem := d.Get(mkOperatingSystem).([]interface{})
|
||||
serialDevice := d.Get(mkSerialDevice).([]interface{})
|
||||
onBoot := types.CustomBool(d.Get(mkOnBoot).(bool))
|
||||
tabletDevice := types.CustomBool(d.Get(mkTabletDevice).(bool))
|
||||
operatingSystem := d.Get(mkOperatingSystem).([]interface{})
|
||||
protection := types.CustomBool(d.Get(mkProtection).(bool))
|
||||
scsiHardware := d.Get(mkSCSIHardware).(string)
|
||||
serialDevice := d.Get(mkSerialDevice).([]interface{})
|
||||
tabletDevice := types.CustomBool(d.Get(mkTabletDevice).(bool))
|
||||
template := types.CustomBool(d.Get(mkTemplate).(bool))
|
||||
vga := d.Get(mkVGA).([]interface{})
|
||||
watchdog := d.Get(mkWatchdog).([]interface{})
|
||||
@ -1958,6 +1959,10 @@ func vmCreateClone(ctx context.Context, d *schema.ResourceData, m interface{}) d
|
||||
updateBody.BIOS = &bios
|
||||
}
|
||||
|
||||
if machine != dvMachineType {
|
||||
updateBody.Machine = &machine
|
||||
}
|
||||
|
||||
if scsiHardware != dvSCSIHardware {
|
||||
updateBody.SCSIHardware = &scsiHardware
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user