[PR #529] [MERGED] Fix: Handle whitespace-only tags from Proxmox API to prevent false Terraform diffs #529

Closed
opened 2026-02-28 00:42:32 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Telmate/proxmox-api-go/pull/529
Author: @aleskxyz
Created: 12/4/2025
Status: Merged
Merged: 12/16/2025
Merged by: @Tinyblargon

Base: masterHead: fix-tags


📝 Commits (1)

  • 9a85e6e Fix: Handle whitespace-only tags from Proxmox API

📊 Changes

1 file changed (+13 additions, -4 deletions)

View changed files

📝 proxmox/type__tag.go (+13 -4)

📄 Description

Problem

Proxmox API sometimes (when you set tag for VMs/containers and then remote it) returns "tags": " " (a single space character) for VMs/containers that have no tags set. This causes false diffs in Terraform when the provider compares the state with the configuration:

~ resource "proxmox_vm_qemu" "vm" {
tags = " " -> null
}

The issue occurs because the SDK's mapToSDK function was treating the whitespace string as a valid tag, creating a Tags slice with a single tag containing a space character.

Solution

Updated Tags.mapToSDK() in proxmox/type__tag.go to:

  • Trim whitespace from the input string before processing
  • Filter out empty tags after splitting by semicolon
  • Return empty Tags{} when the input is only whitespace

This ensures that when Proxmox returns "tags": " ", it's correctly interpreted as "no tags" rather than "one tag with a space".

Test

Before:

./proxmox-api-go get guest config 247 -i | jq '.tags'
[
  " "
]

After:

./proxmox-api-go get guest config 247 -i | jq '.tags'
[]

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Telmate/proxmox-api-go/pull/529 **Author:** [@aleskxyz](https://github.com/aleskxyz) **Created:** 12/4/2025 **Status:** ✅ Merged **Merged:** 12/16/2025 **Merged by:** [@Tinyblargon](https://github.com/Tinyblargon) **Base:** `master` ← **Head:** `fix-tags` --- ### 📝 Commits (1) - [`9a85e6e`](https://github.com/Telmate/proxmox-api-go/commit/9a85e6e4c0f30fcbc7058fe2718c10041e524d38) Fix: Handle whitespace-only tags from Proxmox API ### 📊 Changes **1 file changed** (+13 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `proxmox/type__tag.go` (+13 -4) </details> ### 📄 Description ## Problem Proxmox API sometimes (when you set tag for VMs/containers and then remote it) returns `"tags": " "` (a single space character) for VMs/containers that have no tags set. This causes false diffs in Terraform when the provider compares the state with the configuration: ``` ~ resource "proxmox_vm_qemu" "vm" { tags = " " -> null } ``` The issue occurs because the SDK's `mapToSDK` function was treating the whitespace string as a valid tag, creating a `Tags` slice with a single tag containing a space character. ## Solution Updated `Tags.mapToSDK()` in `proxmox/type__tag.go` to: - Trim whitespace from the input string before processing - Filter out empty tags after splitting by semicolon - Return empty `Tags{}` when the input is only whitespace This ensures that when Proxmox returns `"tags": " "`, it's correctly interpreted as "no tags" rather than "one tag with a space". ## Test Before: ``` ./proxmox-api-go get guest config 247 -i | jq '.tags' [ " " ] ``` After: ``` ./proxmox-api-go get guest config 247 -i | jq '.tags' [] ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-28 00:42:32 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/proxmox-api-go#529
No description provided.