Skip to content

Conversation

@aleskxyz
Copy link
Contributor

@aleskxyz aleskxyz commented Dec 4, 2025

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'
[]

@Tinyblargon Tinyblargon self-assigned this Dec 16, 2025
@Tinyblargon Tinyblargon added type/enhancement An improvement of existing functionality modifies/go Pull requests that update Go code size/S Denotes a PR that changes 10-29 lines, ignoring generated files test/done This PR has been tested and the result was succesfull labels Dec 16, 2025
@Tinyblargon
Copy link
Collaborator

@aleskxyz Thank you for this contribution :)

@Tinyblargon Tinyblargon merged commit 5bfbe76 into Telmate:master Dec 16, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

modifies/go Pull requests that update Go code size/S Denotes a PR that changes 10-29 lines, ignoring generated files test/done This PR has been tested and the result was succesfull type/enhancement An improvement of existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants