I have some Azure VMs where the OS disks seem to have been replaced with new disks from backup snapshots. When I run a plan now Terraform indicates it needs to change the storage_os_disk.name parameter for the VM resources.
~ storage_os_disk {
caching = "ReadWrite"
create_option = "FromImage"
disk_size_gb = 127
managed_disk_id = "/subscriptions/<snip>/resourceGroups/<snip>/providers/Microsoft.Compute/disks/hv-agent-13-final-rescue"
managed_disk_type = "Premium_LRS"
~ name = "hv-agent-13-final-rescue" -> "hv-agent-os-disk-13"
os_type = "Windows"
write_accelerator_enabled = false
}
The storage_os_disk.managed_id parameters for these VM resources are correct (ie the ID of the new disk), and don’t show any needed change in the plan.
I understand you can’t rename a managed disk in Azure, so I’m hoping for some tips on what to expect will happen if we apply.
Follow-up question, what’s the correct way to replace a VM’s OS disk with a new volume from backup snapshots without tripping up Terraform?