Skip to content

Wrong username set in cloud-init (single space: " ") #1797

Open
@morsik

Description

@morsik

Describe the bug
Provider sets " " as username in Proxmox instead of null when I specify null in initialization section.

Then it tries to replace whole VM because username is changed (yes, I know that I can simply change lifecycle to ignore that, but it's still a wrong behavior).

To Reproduce
Steps to reproduce the behavior:

  1. Create a resource proxmox_virtual_environment_vm with following section:

      initialization {
        interface    = "ide2"
        datastore_id = "rbd"
    
        user_account {
          keys = var.ssh_keys
        }
      }
  2. Apply.

  3. VM gets created with " " (single space) as cloud-init's username.

    Image
  4. Apply again. Now terraform wants to replace VM because username is changed to null.

    Image.

  5. BONUS: Manually changing username in Proxmox to empty string (which causes Proxmox to show "(Default)" in username field) fixes issue with provider stats.

Expected behavior
null should be allowed to properly set on cloud-init proxmox to have "(Default)"

Additional context
Add any other context about the problem here.

  • Single or clustered Proxmox: Clustered
  • Proxmox version: 8.3.3
  • Provider version (ideally it should be the latest version): registry.terraform.io/bpg/proxmox v0.73.0
  • Terraform/OpenTofu version: Terraform v1.5.7
  • OS (where you run Terraform/OpenTofu from): macOS 15.3.1 (24D70)

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 bugSomething isn't working

    Projects

    • Status

      📥 Inbox

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions