VSphere Provider thinks template uuid changed when it didn't

Terraform Version: Terraform v1.3.7 on linux_amd64
VSphere Provider Version: hashicorp/vsphere v2.2.0
VSphere Server Version: 7.0.3.01100
ESXi Hypervisor: VMware ESXi, 7.0.2, 18538813

For some reason, template_uuid is marked with “# forces replacement” but the uuid matches the template the VM was built with.

VM has this annotation that I add to track what template it was built with on what date:

annotation                              = "Build by Terraform with template LIN-DEB-E4829-2023-01-11 on 2023-01-24T22:20:11Z" -> (known after apply)

I created a simple tf file to get and show the template_uuid to make sure I wasn’t going crazy:

data "vsphere_virtual_machine" "template" {
  datacenter_id = data.vsphere_datacenter.datacenter.id
  name = "LIN-DEB-E4829-2023-01-11"
}

Outputs:

 + template-uuid   = "4216b42d-55aa-b137-ed74-1d63aebc013d"

Here is the plan that gets created for this VM. It is part of a larger picture, where a VM may depend upon another VM and so on, so I don’t know if the chain is the issue (like some other resource that this VM depends upon has changed so it has to change too), but the plan is only indicating that the thing that is forcing the replacement is the template_uuid so I’m a bit confused.

Terraform Plan:

 # module.myvm.vsphere_virtual_machine.vm[0] must be replaced
-/+ resource "vsphere_virtual_machine" "vm" {
     ~ annotation                              = "Build by Terraform with template LIN-DEB-E4829-2023-01-11 on 2023-01-24T22:20:11Z" -> (known after apply)
     - boot_delay                              = 0 -> null
     - boot_retry_enabled                      = false -> null
     ~ change_version                          = "2023-01-24T22:22:45.512385Z" -> (known after apply)
     - cpu_hot_add_enabled                     = false -> null
     - cpu_hot_remove_enabled                  = false -> null
     - cpu_performance_counters_enabled        = false -> null
     - cpu_reservation                         = 0 -> null
     ~ cpu_share_count                         = 2000 -> (known after apply)
     ~ custom_attributes                       = {
         - "101" = "myattribute"
       } -> (known after apply)
     ~ datastore_id                            = "datastore-1153" -> (known after apply)
     ~ default_ip_address                      = "XXX.XXX.XXX.XXX" -> (known after apply)
     - efi_secure_boot_enabled                 = false -> null
     - enable_disk_uuid                        = false -> null
     - enable_logging                          = false -> null
     - extra_config                            = {} -> null
     ~ guest_id                                = "other4xLinux64Guest" -> (known after apply)
     ~ guest_ip_addresses                      = [
         - "###.###.###.###",
       ] -> (known after apply)
     ~ hardware_version                        = 19 -> (known after apply)
     ~ host_system_id                          = "host-4290" -> (known after apply)
     ~ id                                      = "4216f5ef-af5f-8068-1984-8d2f45971a25" -> (known after apply)
     + imported                                = (known after apply)
     - memory_reservation                      = 0 -> null
     ~ memory_share_count                      = 20480 -> (known after apply)
     ~ moid                                    = "vm-19676" -> (known after apply)
       name                                    = "myvm.name"
     - nested_hv_enabled                       = false -> null
     - pci_device_id                           = [] -> null
     ~ power_state                             = "on" -> (known after apply)
     ~ reboot_required                         = false -> (known after apply)
     ~ resource_pool_id                        = "resgroup-1807" -> (known after apply)
     - run_tools_scripts_before_guest_reboot   = false -> null
     ~ scsi_type                               = "pvscsi" -> (known after apply)
     + storage_policy_id                       = (known after apply)
     - sync_time_with_host                     = false -> null
     - sync_time_with_host_periodically        = false -> null
     - tags                                    = [] -> null
     ~ uuid                                    = "4216f5ef-af5f-8068-1984-8d2f45971a25" -> (known after apply)
     ~ vapp_transport                          = [] -> (known after apply)
     - vbs_enabled                             = false -> null
     ~ vmware_tools_status                     = "guestToolsRunning" -> (known after apply)
     ~ vmx_path                                = "myvm.name/myvm.name.vmx" -> (known after apply)
     - vvtd_enabled                            = false -> null
       # (30 unchanged attributes hidden)

     ~ clone {
         - ovf_network_map = {} -> null
         - ovf_storage_map = {} -> null
         ~ template_uuid   = "4216b42d-55aa-b137-ed74-1d63aebc013d" -> (known after apply) # forces replacement
           # (2 unchanged attributes hidden)

         ~ customize {
             - dns_server_list = [] -> null
             - dns_suffix_list = [] -> null
               # (1 unchanged attribute hidden)

             ~ linux_options {
                   # (3 unchanged attributes hidden)
               }

               # (1 unchanged block hidden)
           }
       }

     ~ disk {
         ~ datastore_id      = "datastore-1153" -> "<computed>"
         ~ device_address    = "scsi:0:0" -> (known after apply)
         ~ io_share_count    = 1000 -> 0
         ~ key               = 2000 -> 0
         ~ path              = "myvm.name/myvm.name.vmdk" -> (known after apply)
         + storage_policy_id = (known after apply)
         ~ uuid              = "6000C296-5d9a-500c-7a5b-219b4f10400b" -> (known after apply)
           # (14 unchanged attributes hidden)
       }

     ~ network_interface {
         ~ bandwidth_share_count = 50 -> (known after apply)
         ~ device_address        = "pci:0:7" -> (known after apply)
         ~ key                   = 4000 -> (known after apply)
         ~ mac_address           = "##:##:##:##:##:##" -> (known after apply)
         ~ network_id            = "network-6161" -> (known after apply)
         - use_static_mac        = false -> null
           # (4 unchanged attributes hidden)
       }
   }

Any thoughts?

Thank you,
Paul

I think I can confirm this on vCenter 6.7 as well

$ terraform --version
Terraform v1.3.9
on linux_amd64
+ provider registry.terraform.io/hashicorp/vsphere v2.2.0

vSphere Client version 6.7.0.46000