Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DNS servers block results in unexpected change #841

Closed
dronenb opened this issue Dec 28, 2023 · 4 comments · Fixed by #844
Closed

DNS servers block results in unexpected change #841

dronenb opened this issue Dec 28, 2023 · 4 comments · Fixed by #844
Labels
🐛 bug Something isn't working

Comments

@dronenb
Copy link

dronenb commented Dec 28, 2023

First off, let me just say thank you for all your hard work developing this excellent provider.

Describe the bug
When I specify DNS servers using new servers list format for a vm as follows:

resource "proxmox_virtual_environment_vm" "k3s_server_vm" {
  initialization {
    dns {
      servers = ["10.91.1.1"]
    }
    ...
  }
  ...
}

The VM gets created correctly:
Screenshot 2023-12-27 at 23 59 58

However, subsequent terraform plan's yield:

~ resource "proxmox_virtual_environment_vm" "k3s_server_vm" {
        id                      = "105"
        name                    = "k3s-server0"
        tags                    = [
            "debian",
            "k3s",
            "k3s-master",
            "terraform",
        ]
        # (26 unchanged attributes hidden)

      ~ initialization {
            # (2 unchanged attributes hidden)

          ~ dns {
              - server  = "10.91.1.1" -> null
                # (1 unchanged attribute hidden)
            }

            # (2 unchanged blocks hidden)
        }

        # (8 unchanged blocks hidden)
    }

Expected behavior
Subsequent terraform plan's should not result in any planned changes.

  • Single or clustered Proxmox: Single
  • Provider version (ideally it should be the latest version): 0.42.0
  • Terraform version: v1.6.6
  • OS (where you run Terraform from): macOS
  • Debug logs (TF_LOG=DEBUG terraform apply):
@bitchecker
Copy link
Contributor

I can confirm the reported behavior.

To avoid this issue, I added in my code config this lifecycle statement:

lifecycle {
    ignore_changes = [
      initialization
    ]
  }

It seems to be too much (and it is) but, it prevents every unwanted reboots. If I need to change something, I can simply rebuild the instance.

@rafsaf
Copy link
Contributor

rafsaf commented Dec 28, 2023

Looks like mea culpa in #832

It was an attempt to add servers without breaking change of server but well 😢

Thinking fast, maybe providing both attributes will be temporary fix? Or just downgrade to v0.41.0

resource "proxmox_virtual_environment_vm" "k3s_server_vm" {
  initialization {
    dns {
      server = "10.91.1.1"
      servers = ["10.91.1.1"]
    }
    ...
  }
  ...
}

@bpg
Copy link
Owner

bpg commented Dec 28, 2023

Let me take a look... 👀

@dandyrow
Copy link
Contributor

I had noticed this as well. I was going to look into trying to see if there would be a way to put in some logic to maybe check if servers was being used then to ignore the server being set or set it in the code as they shouldn't be defined differently. Not ideal solution.

In the meantime I was able to prevent the change coming up by just defining the server attribute as well as servers with the same value. This worked with the side effect of showing a deprecated attribute warning however this is better than having terraform reboot the VM. The ideal solution, I think, would be to remove the server attribute but obviously that introduces a, albeit small, breaking change unfortunately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
5 participants