From b3e1ffe0c2362711ef68300ba9de4bf3e91efe02 Mon Sep 17 00:00:00 2001 From: Tinyblargon <76069640+Tinyblargon@users.noreply.github.com> Date: Mon, 25 Nov 2024 18:35:03 +0100 Subject: [PATCH] feat: `Managed by Terraform.` (#1177) --- proxmox/resource_pool.go | 5 ++++- proxmox/resource_vm_qemu.go | 6 ++++-- proxmox/util.go | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/proxmox/resource_pool.go b/proxmox/resource_pool.go index f03407ed..94349daf 100644 --- a/proxmox/resource_pool.go +++ b/proxmox/resource_pool.go @@ -8,6 +8,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) +const schemaPoolComment = "comment" + var poolResourceDef *schema.Resource func resourcePool() *schema.Resource { @@ -26,8 +28,9 @@ func resourcePool() *schema.Resource { Required: true, ForceNew: true, }, - "comment": { + schemaPoolComment: { Type: schema.TypeString, + Default: defaultDescription, Optional: true, }, }, diff --git a/proxmox/resource_vm_qemu.go b/proxmox/resource_vm_qemu.go index 2a46cc5c..f08882d4 100755 --- a/proxmox/resource_vm_qemu.go +++ b/proxmox/resource_vm_qemu.go @@ -49,6 +49,8 @@ const ( ) const ( + schemaQemuDescription = "desc" + schemaAdditionalWait = "additional_wait" schemaAgentTimeout = "agent_timeout" schemaSkipIPv4 = "skip_ipv4" @@ -135,13 +137,13 @@ func resourceVmQemu() *schema.Resource { return }, }, - "desc": { + schemaQemuDescription: { Type: schema.TypeString, Optional: true, DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { return strings.TrimSpace(old) == strings.TrimSpace(new) }, - // Default: "", + Default: defaultDescription, Description: "The VM description", }, "target_node": { diff --git a/proxmox/util.go b/proxmox/util.go index 1a801f53..a68bf535 100644 --- a/proxmox/util.go +++ b/proxmox/util.go @@ -16,7 +16,7 @@ import ( "github.com/rs/zerolog" ) -// const defaultTimeout = 300 +const defaultDescription = "Managed by Terraform." var rxRsId = regexp.MustCompile(`([^/]+)/([^/]+)/(\d+)`)