I want to know why resize a datadisk attached to a running VM by terraform cause the VM to reboot?

Hoàng Ân 0 Reputation points
2024-05-06T08:45:52.92+00:00

My VM and datadisk fulfill the requirement to expand without downtime https://learn.microsoft.com/en-us/azure/virtual-machines/windows/expand-os-disk#expand-without-downtime.

VM information: Standard F8s v2 (8 vcpus, 16 GiB memory), Windows (Windows Server 2019 Datacenter),Microsoft.Compute/virtualMachines.

Datadisk information: Standard HDD LRS 256GB 500 IOPS 60 Max through put Encyption SSE with PMK

So WHY it reboot the VM when I change only the disk size from terraform?

Thankyou for your answers in advance!

Azure Disk Storage
Azure Disk Storage
A high-performance, durable block storage designed to be used with Azure Virtual Machines and Azure VMware Solution.
581 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. akinbade abiola 1,105 Reputation points
    2024-05-06T09:01:43.47+00:00

    Hello Hoàng Ân

    In Azure, changing the size of an OS disk typically does not require a VM reboot when done through the Azure Portal or Azure CLI . However, Terraform behaves differently due to the way it handles disk resizing operations.

    This feature has the limitations on this to the below

    To avoid a reboot, the disk resize operation needs to be perceived by Terraform as a non-disruptive change or run using CLI commands.

    Please let me know if you have further questions

    You can mark it 'Accept Answer' if this helped.

    0 comments No comments