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

TF doesn't detach disks from a VM when resizing the disk beyond 4095 GiB causing an Azure Error #10792

Closed
kazikfriedrich opened this issue Mar 2, 2021 · 3 comments · Fixed by #21620

Comments

@kazikfriedrich
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform (and AzureRM Provider) Version

Terraform v0.12.30
terraform-provider-azurerm_v2.48.0

Affected Resource(s)

  • azurerm_managed_disk

Terraform Configuration Files

resource "azurerm_managed_disk" "data_disk" {
  name                 = "data_disk"
  location             = "West US 2"
  resource_group_name  = azurerm_resource_group.resource_group.name
  storage_account_type = "Standard_LRS"
  create_option        = "Empty"
  disk_size_gb         = "9000" ### Going up from 4000

  tags = {
    environment = "dev"
  }
}

Debug Output

https://gist.github.com/kazikfriedrich/fc455894d5561463016a30ad106ad977

Expected Behaviour

TF should perform the following actions when resizing the disk over 4095 GiB:

  1. Stop the VM
  2. Detach the disk
  3. Resize disk
  4. Attach disk back
  5. Start the VM

Actual Behaviour

  1. TF stops the VM
  2. TF attempts to resize disk
  3. Azure returns the Disks cannot be resized beyond 4095 GiB when attached to a VM error:
Error: Error updating Managed Disk "some_disk_name" (Resource Group "name-of-resource-group"): compute.DisksClient#Update: Failure sending request: StatusCode=0 -- Original Error: Code="BadRequest" Message="Disks cannot be resized beyond 4095 GiB when attached to a VM. Detach disk some_disk_name from VM /subscriptions/some_uuid/resourceGroups/name-of-resource-group/providers/Microsoft.Compute/virtualMachines/some-hostname and try again. If caching is enabled for this disk, it will not be supported for disks greater than 4095 GiB."

Steps to Reproduce

Create a VM, attach a disk of any size below 4095GiB, attempt to resize the attached disk to anything over 4095GiB

@RawPatty
Copy link

RawPatty commented Jan 19, 2023

I am also having a simliar issue with running terraform 1.3.7 - although the hot extend function is supposed to kick in, I get an error after the machine is deallocated

Terraform behaviour is as below when resizing data disks on running VMs:

 

Action Result Notes
4GiB -> 4095GiB   Hot extend with no issue no outage is required
Below 4095GiB to 4096GiB or above Error with outage To successfully resize, I had to manually detach the disk and reapply the plan. The plan would create a new attachment object and make a data disk  change to the size This use case causes an unexpected outage to the virtual machine, but also then fails.
4096GiB to 8192GiB + Error with no outage To successfully resize from here with Terraform, the VM needed to be manually shut down before applying the plan. This would require an outage to the machine successfully apply
8192GiB + Hot extend with no issues No outage is required

 

@github-actions
Copy link

github-actions bot commented May 5, 2023

This functionality has been released in v3.55.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants