Skip to content

When updating container's IP, its DNS settings are reset to empty strings #1786

Open
@Renerick

Description

@Renerick

Describe the bug
When updating container's IP, its DNS settings are set to an empty string instead of null, causing DNS configuration to break, as instead of using host's DNS configuration, it has invalid one.

To Reproduce
Steps to reproduce the behavior:

  1. Create a resource proxmox_virtual_environment_container with initialization.dns unset
  2. Run terraform apply
  3. Observe terraform state
    "dns": [],
  4. Modify the resource proxmox_virtual_environment_container by changing its IP (haven't tested if other network related settings trigger this bug. I also tried changing cores number, it did not trigger)
  5. Run terraform apply
  6. Observe terraform state
    "dns": [
        {
              "domain": " ",
              "server": "",
              "servers": [
                      "",
                      ""
              ]
         }
    ],

Please also provide a minimal Terraform configuration that reproduces the issue.

resource "proxmox_virtual_environment_container" "ubuntu_container" {
  vm_id     = 9876

  node_name = "pve-1"
  unprivileged = true

  features {
    nesting = true
  }

  initialization {
    hostname = "repro"

    ip_config {
      ipv4 {
        address = "10.0.0.2/16"
        gateway = "10.0.0.1"
      }
    }

    user_account {
      password = "pwdpwd"
    }
  }

  network_interface {
    name = "eth0"
  }

  disk {
    size = 4
    // put your disk in here
  }

  cpu {
    cores = 1
  }

  operating_system {
    template_file_id = "local:vztmpl/ubuntu-24.10-standard_24.10-1_amd64.tar.zst"
    type             = "ubuntu"
  }
}

and the output of terraform|tofu apply.

  # proxmox_virtual_environment_container.repro will be updated in-place
  ~ resource "proxmox_virtual_environment_container" "repro" {
        id             = "9876"
        tags           = []
        # (13 unchanged attributes hidden)

      ~ initialization {
            # (1 unchanged attribute hidden)

          + ip_config {
              + ipv4 {
                  + address = "10.10.0.2/16"
                  + gateway = "10.10.0.1"
                }
            }
        }

        # (5 unchanged blocks hidden)
    }

Expected behavior
DNS settings of the container remain untouched

Screenshots
This is how container's DNS configuration looks before and after the update

Image

Image

Additional context
Add any other context about the problem here.

  • Single or clustered Proxmox: single node
  • Proxmox version: Virtual Environment 8.3.4
  • Provider version (ideally it should be the latest version): 0.72.0
  • Terraform/OpenTofu version:
    Terraform v1.10.5
    on windows_amd64
    
  • OS (where you run Terraform/OpenTofu from): Windows 10 x64
  • Debug logs (TF_LOG=DEBUG terraform apply): https://gist.github.com/Renerick/e3515c702990920efffe1c38dc975a40

Metadata

Metadata

Assignees

No one assigned

    Projects

    • Status

      ☑️ Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions