terraform-provider-azurerm: azurerm_linux_virtual_machine does not support data disks which is blocking for cloud-init configuration
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
Affected Resource(s)
azurerm_linux_virtual_machine
Important Factoids
The azurerm_virtual_machineresource supports data_disks, but this isnβt possible with the new azurerm_linux_virtual_machine or azurerm_windows_virtual_machine.
[edit]
As soon as the vm is created, the cloud-init initialization starts. As we can not attach a data disk in a single operation with azurerm_linux_virtual_machine, we can not mount nor do anything with the data disk during the cloud-init operation.
However, itβs pretty common (a best practice) to
- use cloud-init for vm initialization
- rely on a data disk for persistent data
π This use case is not possible anymore. π’
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 47
- Comments: 17 (10 by maintainers)
Thanks @ArcturusZhang for your answer.
But having a separate resource for that does not enable my use case, where the custom data script (a cloud-init script) mount the data disk volume and do stuff on it.
Reporting error relating to this issue
Message="StorageProfile.dataDisks.lun does not have required value(s) for image specified in storage profile." Target="storageProfile"Similar to the error you see for the windows virtual machine resource #6004
Hi @boillodmanuel thanks for this issue, but in 2.0 the
azurerm_linux_virtual_machine(as well asazurerm_windows_virtual_machine) must use the new resourceazurerm_virtual_machine_data_disk_attachmentto attach data disk for them. Here is the doc page forazurerm_virtual_machine_data_disk_attachment: https://www.terraform.io/docs/providers/azurerm/r/virtual_machine_data_disk_attachment.html