From b3caf6af8252e1fc737489f71534b96188f50631 Mon Sep 17 00:00:00 2001 From: Pavel Boldyrev <627562+bpg@users.noreply.github.com> Date: Tue, 30 Apr 2024 21:01:23 -0400 Subject: [PATCH] fix: use `raw` file format for `efi_disk` by default (#1249) Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com> --- docs/resources/virtual_environment_vm.md | 2 +- fwprovider/tests/resource_vm_test.go | 24 ++++++++++++++++++++++++ proxmoxtf/resource/vm/vm.go | 2 +- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/docs/resources/virtual_environment_vm.md b/docs/resources/virtual_environment_vm.md index 4c2bdc02..34b3d7b3 100644 --- a/docs/resources/virtual_environment_vm.md +++ b/docs/resources/virtual_environment_vm.md @@ -293,7 +293,7 @@ output "ubuntu_vm_public_key" { to `ovmf`) - `datastore_id` (Optional) The identifier for the datastore to create the disk in (defaults to `local-lvm`). - - `file_format` (Optional) The file format. + - `file_format` (Optional) The file format (defaults to `raw`). - `type` (Optional) Size and type of the OVMF EFI disk. `4m` is newer and recommended, and required for Secure Boot. For backwards compatibility use `2m`. Ignored for VMs with cpu.architecture=`aarch64` (defaults diff --git a/fwprovider/tests/resource_vm_test.go b/fwprovider/tests/resource_vm_test.go index 2f25192e..2d59baee 100644 --- a/fwprovider/tests/resource_vm_test.go +++ b/fwprovider/tests/resource_vm_test.go @@ -609,6 +609,30 @@ func TestAccResourceVMDisks(t *testing.T) { RefreshState: true, }, }}, + {"efi disk", []resource.TestStep{ + { + Config: te.renderConfig(` + resource "proxmox_virtual_environment_vm" "test_efi_disk" { + node_name = "{{.NodeName}}" + started = false + name = "test-efi-disk" + + efi_disk { + datastore_id = "local-lvm" + type = "4m" + } + }`), + Check: resource.ComposeTestCheckFunc( + testResourceAttributes("proxmox_virtual_environment_vm.test_efi_disk", map[string]string{ + "efi_disk.0.datastore_id": "local-lvm", + "efi_disk.0.type": "4m", + }), + ), + }, + { + RefreshState: true, + }, + }}, {"ide disks", []resource.TestStep{ { Config: te.renderConfig(` diff --git a/proxmoxtf/resource/vm/vm.go b/proxmoxtf/resource/vm/vm.go index 18b0f1df..9496fca7 100644 --- a/proxmoxtf/resource/vm/vm.go +++ b/proxmoxtf/resource/vm/vm.go @@ -72,7 +72,7 @@ const ( dvDescription = "" dvEFIDiskDatastoreID = "local-lvm" - dvEFIDiskFileFormat = "qcow2" + dvEFIDiskFileFormat = "raw" dvEFIDiskType = "2m" dvEFIDiskPreEnrolledKeys = false dvTPMStateDatastoreID = "local-lvm"