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

azurerm_virtual_machine tries to change name of a disk rather than detach/create/attach #1668

Closed
Supermathie opened this issue Jul 27, 2018 · 3 comments
Labels
bug microsoft/4 service/disk-attachments Virtual Machine Disk Attachments
Milestone

Comments

@Supermathie
Copy link
Contributor

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 Version

Terraform v0.11.7

  • provider.azurerm v1.11.0
  • provider.random v1.3.1
  • provider.template v1.0.0

Affected Resource(s)

  • azurerm_virtual_machine

Terraform Configuration Files

 azurerm_virtual_machine {
   …
-  # swap
+  # data disks
   storage_data_disk {
-    name              = "build-swap"
+    name              = "build-data"
     managed_disk_type = "Standard_LRS"
     create_option     = "Empty"
     lun               = 0
-    disk_size_gb      = "${var.swap_size}"
+    disk_size_gb      = "${var.data_size}"
   }
 }

Debug Output

Panic Output

Expected Behavior

terraform should

  • detach disk
  • destroy old disk
  • create disk
  • attach disk

Actual Behavior

  ~ module.monitor.azurerm_virtual_machine.monitor[0]
      storage_data_disk.0.disk_size_gb:         "2" => "32"
      storage_data_disk.0.name:                 "monitor-0-swap" => "monitor-0-data"
…

* azurerm_virtual_machine.monitor.0: compute.VirtualMachinesClient#CreateOrUpdate: Failure sending request: StatusCode=0 -- Original Error: autorest/azure: Service returned an error. Status=<nil> Code="PropertyChangeNotAllowed" Message="Changing property 'dataDisk.name' is not allowed." Target="dataDisk.name"

Steps to Reproduce

  1. terraform apply

Important Factoids

References

  • Ø
@jackofallops
Copy link
Member

Closing this issue as we're currently working on version 2.0 of the Azure Provider which we previously announced in #2807.

As a part of this we're introducing five new resources which will supersede the existing azurerm_virtual_machine and azurerm_virtual_machine_scale_set resources:

azurerm_linux_virtual_machine
azurerm_linux_virtual_machine_scale_set
azurerm_virtual_machine_scale_set_extension
azurerm_windows_virtual_machine
azurerm_windows_virtual_machine_scale_set

We recently opened #5550 which adds support for the new Virtual Machine resources - which require attaching Data Disks using the azurerm_managed_disk and azurerm_virtual_machine_data_disk_attachment resources rather than having them defined inline, which allows for more granular control/flexibility when modifying disks. Since the existing Virtual Machine resource is being superseded, unfortunately we have no plans to backport this to the existing azurerm_virtual_machine resource - however we’ll be publishing information on the new resources (and how you can opt-into the Beta) in the near-future.

Thanks

@ghost
Copy link

ghost commented Feb 24, 2020

This has been released in version 2.0.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.0.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Mar 4, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug microsoft/4 service/disk-attachments Virtual Machine Disk Attachments
Projects
None yet
Development

No branches or pull requests

5 participants