I am very new to terraform, so i am not sure if it is something in my configuration files, terraform, or the provider (proxmox bpg). I created a configuration file to create some VMs for a kubernetes cluster. the plan runs just fine and the apply does as well, but if i re-run the plan, even though nothing has changed, it says the tags will be updated:
data.proxmox_virtual_environment_nodes.proxmox_nodes: Reading...
data.proxmox_virtual_environment_nodes.proxmox_nodes: Read complete after 0s [id=nodes]
proxmox_virtual_environment_vm.example[2]: Refreshing state... [id=2002]
proxmox_virtual_environment_vm.example[3]: Refreshing state... [id=2020]
proxmox_virtual_environment_vm.example[4]: Refreshing state... [id=2021]
proxmox_virtual_environment_vm.example[1]: Refreshing state... [id=2001]
proxmox_virtual_environment_vm.example[0]: Refreshing state... [id=2000]
proxmox_virtual_environment_vm.example[5]: Refreshing state... [id=2022]
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# proxmox_virtual_environment_vm.example[0] will be updated in-place
~ resource "proxmox_virtual_environment_vm" "example" {
id = "2000"
name = "k3s-master-01"
~ tags = [
- "kubernetes",
- "local-storage",
- "master",
"terraform",
"ubuntu-2204",
+ "local-storage",
+ "kubernetes",
+ "master",
]
# (21 unchanged attributes hidden)
# (7 unchanged blocks hidden)
}
same change repeats for all 6 of the VMs that were created. the configuration file is pretty vanilla:
# get the nodes in the cluster
data "proxmox_virtual_environment_nodes" "proxmox_nodes" {}
# VM Definition
resource "proxmox_virtual_environment_vm" "example" {
count = var.vm_count
name = count.index + 1 <= var.vm_masters ? "${var.vm_name}-master-${format("%02d", count.index + 1)}" : "${var.vm_name}-worker-${format("%02d", count.index - (var.vm_masters - 1))}"
node_name = data.proxmox_virtual_environment_nodes.proxmox_nodes.names[count.index % length(data.proxmox_virtual_environment_nodes.proxmox_nodes.names)]
vm_id = count.index + 1 <= var.vm_masters ? var.vm_proxmox_id + count.index : var.vm_proxmox_id + count.index + (20 - var.vm_masters)
tags = count.index + 1 <= var.vm_masters ? "${concat(var.vm_proxmox_tags, ["master"])}" : "${concat(var.vm_proxmox_tags, ["worker"])}"
# reboot = true
agent {
enabled = true
trim = true
}
cpu {
sockets = var.vm_sockets
cores = var.vm_cores
}
memory {
dedicated = count.index + 1 <= var.vm_masters ? var.vm_mem_master : var.vm_mem_worker
}
disk {
interface = "scsi0"
datastore_id = var.clone_target_datastore
ssd = true
size = 36
iothread = true
discard = "on"
}
# Define the network interface with the specific Mac Address
network_device {
model = "virtio"
mac_address = count.index + 1 <= var.vm_masters ? "${var.net_mac_address_base}AA:${format("%02d", count.index)}" : "${var.net_mac_address_base}BB:${format("%02d", count.index - var.vm_masters)}"
vlan_id = var.net_vlan_id
bridge = var.net_bridge
}
serial_device {}
# clone information
clone {
vm_id = var.clone_vm_id + (count.index % var.vm_masters)
datastore_id = var.clone_target_datastore
node_name = data.proxmox_virtual_environment_nodes.proxmox_nodes.names[count.index % length(data.proxmox_virtual_environment_nodes.proxmox_nodes.names)]
}
}
am i doing something wroing?