terraform-azurerm-compute icon indicating copy to clipboard operation
terraform-azurerm-compute copied to clipboard

add support on extra_disks with iops

Open sb185296 opened this issue 3 years ago • 1 comments

hi team ,

its will be great that when you using extra_disks that we be able to use Disk IOPS

disk_iops_read_write disk_mbps_read_write

its somting that will be as very help when we try to create disk its come with default values

sb185296 avatar Mar 01 '22 09:03 sb185296

Thanks for opening this issue!

azureterraformbot[bot] avatar Mar 01 '22 09:03 azureterraformbot[bot]

Hi @sb185296 thanks for opening this issue, I'd like to try a pr for this feature, but may I ask which specific arguments you would like to have for the azurerm_virtual_machine resource? Could you please give me some pseudo code to demonstrate your requirement? Thanks!

lonegunmanb avatar Nov 25 '22 12:11 lonegunmanb

i wont to create new VM and be able to create extra disk with spsifce IOPS

sb185296 avatar Nov 26 '22 19:11 sb185296

@sb185296 Would you please tell me which argument you'd like to set for your disk?

lonegunmanb avatar Nov 27 '22 02:11 lonegunmanb

IOPS + Tair like in the portal image

sb185296 avatar Nov 27 '22 05:11 sb185296

@sb185296 thanks for your reply, we need some time to investigate how to implement this feature, I'll keep you updated on progress.

lonegunmanb avatar Nov 28 '22 01:11 lonegunmanb

@sb185296 I've finished my investigation, unfortunately it seems impossible to implement this feature in this module, and here's why:

There're two ways to attach a data disk on a virtual machine resource:

  1. storage_data_disk nested block
  2. azurerm_virtual_machine_data_disk_attachment resource

For the first approach, as you can see in the document, there's no way to set disk's iops in this nested block, and as azurerm_virtual_machine has been replaced by new resources like azurerm_linux_virtual_machine, I don't think we can add this new features to this resource.

We can set iops in azurerm_managed_disk resource, then attach this disk to our vm via azurerm_virtual_machine_data_disk_attachment resource, but unfortunately as the document said:

Data Disks can be attached either directly on the azurerm_virtual_machine resource, or using the azurerm_virtual_machine_data_disk_attachment resource - but the two cannot be used together. If both are used against the same Virtual Machine, spurious changes will occur.

We've got storage_data_disk nested block declared already in our azurerm_virtual_machine resource so we cannot just add azurerm_virtual_machine_data_disk_attachment in this module. Another way is rewriting the storage_data_disk to azurerm_managed_disk and azurerm_virtual_machine_data_disk_attachment, but that'll be way too much for this module and might brought breaking changes.

One way is create your vm by using this module with var.nb_data_disk = 0, and declare your managed disk in another module, then we glue the disk and the vm by azurerm_virtual_machine_data_disk_attachment. I'll do a test, if it works, I'll provide you a sample code.

lonegunmanb avatar Nov 28 '22 07:11 lonegunmanb

hi thanks for the answer i will check that and update

thanks for that

sb185296 avatar Nov 28 '22 08:11 sb185296