From b978955641b0eac0c407e8473de1667fa7f31e76 Mon Sep 17 00:00:00 2001 From: Lucas Hahn Date: Mon, 26 Oct 2020 13:40:09 +0100 Subject: [PATCH 1/3] Use correct ide devices for cloud init --- proxmoxtf/resource_virtual_environment_vm.go | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/proxmoxtf/resource_virtual_environment_vm.go b/proxmoxtf/resource_virtual_environment_vm.go index cfa58955..de12d089 100644 --- a/proxmoxtf/resource_virtual_environment_vm.go +++ b/proxmoxtf/resource_virtual_environment_vm.go @@ -1169,7 +1169,7 @@ func resourceVirtualEnvironmentVMCreateClone(d *schema.ResourceData, m interface cdromMedia := "cdrom" - updateBody.IDEDevices = proxmox.CustomStorageDevices{ + ideDevices = proxmox.CustomStorageDevices{ "ide3": proxmox.CustomStorageDevice{ Enabled: cdromEnabled, FileVolume: cdromFileID, @@ -1221,7 +1221,7 @@ func resourceVirtualEnvironmentVMCreateClone(d *schema.ResourceData, m interface cdromCloudInitFileID := fmt.Sprintf("%s:cloudinit", initializationDatastoreID) cdromCloudInitMedia := "cdrom" - updateBody.IDEDevices = proxmox.CustomStorageDevices{ + ideDevices = proxmox.CustomStorageDevices{ "ide2": proxmox.CustomStorageDevice{ Enabled: cdromCloudInitEnabled, FileVolume: cdromCloudInitFileID, @@ -1594,12 +1594,12 @@ func resourceVirtualEnvironmentVMCreateCustom(d *schema.ResourceData, m interfac ideDevice2Media := "cdrom" ideDevices := proxmox.CustomStorageDevices{ - "ide1": proxmox.CustomStorageDevice{ + "ide2": proxmox.CustomStorageDevice{ Enabled: cdromCloudInitEnabled, FileVolume: cdromCloudInitFileID, Media: &ideDevice2Media, }, - "ide2": proxmox.CustomStorageDevice{ + "ide3": proxmox.CustomStorageDevice{ Enabled: cdromEnabled, FileVolume: cdromFileID, Media: &ideDevice2Media, @@ -1663,13 +1663,6 @@ func resourceVirtualEnvironmentVMCreateCustom(d *schema.ResourceData, m interfac createBody.VirtualIODevices = virtioDeviceObjects } - //this will most likely break the cdrom part thats why ide is disabled in line 2017 - /* - if ideDevices != nil { - createBody.IDEDevices = ideDeviceObjects - } - */ - // Only the root account is allowed to change the CPU architecture, which makes this check necessary. if veClient.Username == proxmox.DefaultRootAccount || cpuArchitecture != dvResourceVirtualEnvironmentVMCPUArchitecture { createBody.CPUArchitecture = &cpuArchitecture From 586d3877b54e3dd644b639108233e33d6a7b6fa5 Mon Sep 17 00:00:00 2001 From: Lucas Hahn Date: Mon, 4 Jan 2021 14:42:40 +0100 Subject: [PATCH 2/3] Extend documentation with on_boot and reboot parameter --- docs/resources/vm.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/resources/vm.md b/docs/resources/vm.md index 94babae4..7bea83cb 100644 --- a/docs/resources/vm.md +++ b/docs/resources/vm.md @@ -247,6 +247,7 @@ output "ubuntu_vm_public_key" { * `rate_limit` - (Optional) The rate limit in megabytes per second. * `vlan_id` - (Optional) The VLAN identifier. * `node_name` - (Required) The name of the node to assign the virtual machine to. +* `on_boot` - (Optional) Specifies whether a VM will be started during system boot. (defaults to `false`) * `operating_system` - (Optional) The Operating System configuration. * `type` - (Optional) The type (defaults to `other`). * `l24` - Linux Kernel 2.4. @@ -262,6 +263,7 @@ output "ubuntu_vm_public_key" { * `wvista` - Windows Vista. * `wxp` - Windows XP. * `pool_id` - (Optional) The identifier for a pool to assign the virtual machine to. +* `reboot` - (Optional) Reboot the VM after initial creation. (defaults to `false`) * `serial_device` - (Optional) A serial device (multiple blocks supported). * `device` - (Optional) The device (defaults to `socket`). * `/dev/*` - A host serial device. From 48ad150b80bfa790e97a07dba022e8772fcf975a Mon Sep 17 00:00:00 2001 From: Lucas Hahn Date: Mon, 4 Jan 2021 15:00:58 +0100 Subject: [PATCH 3/3] Update CHANGELOG.md --- CHANGELOG.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 199ce9a5..e4ff501d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,25 @@ FEATURES: * **New Data Source:** `proxmox_virtual_environment_time` * **New Resource:** `proxmox_virtual_environment_time` +BREAKING CHANGES: + +* `interface` is now required to create disks + +``` + disk { + datastore_id = "local-lvm" + file_id = "${proxmox_virtual_environment_file.ubuntu_cloud_image.id}" + interface = "scsi0" + } +``` + ENHANCEMENTS: * provider/configuration: Add `virtual_environment.otp` argument for TOTP support * resource/virtual_environment_vm: Clone supports resize and datastore_id for moving disks * resource/virtual_environment_vm: Bulk clones can now use retries as argument to try multiple times to create a clone. +* resource/virtual_environment_vm: `on_boot` parameter can be used to start a VM after the Node has been rebooted. +* resource/virtual_environment_vm: `reboot` parameter can be used to reboot a VM after creation BUG FIXES: