From 2785c40d44ca950742cbd78e6b720b25bb6e7826 Mon Sep 17 00:00:00 2001 From: Pavel Boldyrev <627562+bpg@users.noreply.github.com> Date: Wed, 29 May 2024 21:36:47 -0400 Subject: [PATCH] fix(vm): regression: `vga.clipboard` attribute check (#1340) Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com> --- example/resource_virtual_environment_vm.tf | 4 ++++ fwprovider/test/resource_vm_test.go | 20 +++++++++++++++++++- fwprovider/vm/vga/resource_test.go | 3 +++ proxmoxtf/resource/vm/vm.go | 1 + 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/example/resource_virtual_environment_vm.tf b/example/resource_virtual_environment_vm.tf index 823db9ea..bbbb1df2 100644 --- a/example/resource_virtual_environment_vm.tf +++ b/example/resource_virtual_environment_vm.tf @@ -107,6 +107,10 @@ resource "proxmox_virtual_environment_vm" "example_template" { serial_device {} + vga { + type = "qxl" + } + template = true // use auto-generated vm_id diff --git a/fwprovider/test/resource_vm_test.go b/fwprovider/test/resource_vm_test.go index 60fae670..5ead6a3d 100644 --- a/fwprovider/test/resource_vm_test.go +++ b/fwprovider/test/resource_vm_test.go @@ -175,7 +175,8 @@ func TestAccResourceVM(t *testing.T) { }`), Check: resource.ComposeTestCheckFunc( ResourceAttributes("proxmox_virtual_environment_vm.test_vm", map[string]string{ - "vga.0.type": "none", + "vga.0.type": "none", + "vga.0.clipboard": "", }), ), }, { @@ -195,6 +196,23 @@ func TestAccResourceVM(t *testing.T) { "vga.0.clipboard": "vnc", }), ), + }, { + Config: te.RenderConfig(` + resource "proxmox_virtual_environment_vm" "test_vm" { + node_name = "{{.NodeName}}" + started = false + + vga { + type = "virtio-gl" + clipboard = "" + } + }`), + Check: resource.ComposeTestCheckFunc( + ResourceAttributes("proxmox_virtual_environment_vm.test_vm", map[string]string{ + "vga.0.type": "virtio-gl", + "vga.0.clipboard": "", + }), + ), }}, }, } diff --git a/fwprovider/vm/vga/resource_test.go b/fwprovider/vm/vga/resource_test.go index 096836bd..b4ee4be4 100644 --- a/fwprovider/vm/vga/resource_test.go +++ b/fwprovider/vm/vga/resource_test.go @@ -66,6 +66,9 @@ func TestAccResourceVM2VGA(t *testing.T) { "vga.type": "std", "vga.memory": "16", }), + test.NoResourceAttributesSet("proxmox_virtual_environment_vm2.test_vm", []string{ + "vga.clipboard", + }), ), }, { // now update the vga params and check if they are updated diff --git a/proxmoxtf/resource/vm/vm.go b/proxmoxtf/resource/vm/vm.go index 473a0468..96f2a981 100644 --- a/proxmoxtf/resource/vm/vm.go +++ b/proxmoxtf/resource/vm/vm.go @@ -1403,6 +1403,7 @@ func VM() *schema.Resource { Optional: true, Default: dvVGAClipboard, ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice([]string{ + "", "vnc", }, true)), },