Attach disk using azurerm virtual machine data_disk_attachment to vmss

Hi TF gurus,

I am looking for an option to attach managed disk to an individual VMSS instance outside of scale-set model so that we can move the disk to a new scale-set in case we want to get rid of the old vmss. Overall idea behind this is to keep the data intact and brings up database on new VM/VMSS in shortest possible time. I understand I can attach data disk while creating the VMSS using azurerm_linux_virtual_machine_scale_set resource but with this we won’t be able to detach the disks as VM and storage lifecycle goes together. Currently azurerm_virtual_machine_data_disk_attachment supports adding disk to a standalone VM but I didn’t find any option by which same can be done with a vmss. Can anyone help me with this?

Thanks in advance.

1 Like

Did you find a solution to this?