hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.62k stars 4.65k forks source link

Support for data source `azurerm_virtual_machine_size` #18078

Open sergelogvinov opened 2 years ago

sergelogvinov commented 2 years ago

Is there an existing issue for this?

Community Note

Description

Data source azurerm_virtual_machine_size helps to define VM capabilities by SKU name. The capabilities which very interested:

New or Affected Resource(s)/Data Source(s)

azurerm_virtual_machine_size

Potential Terraform Configuration

data "azurerm_virtual_machine_size" "size" {
  name     = "Standard_D2pls_v5"
  location = "westeurope"
}

resource "azurerm_linux_virtual_machine_scale_set" "worker" {
  ...
  source_image_reference {
    location  = "westeurope"
    publisher = "Canonical"
    offer     = "0001-com-ubuntu-server-jammy"
    sku       = "22_04-lts-${data.azurerm_virtual_machine_size.size.architecture == "Arm64" ? "arm64" : "gen2"}"
    version   = "latest"
  }
}

References

Go SDK has such methods already, first method has more details about VM

jpbuecken commented 3 weeks ago

Hello, I want to add our Use Case here:

Azure has now VM series that support different disk controller: With SCSI only, NVME only or both.

https://learn.microsoft.com/en-us/azure/virtual-machines/enable-nvme-faqs#will-azure-continue-to-support-scsi-interface-vms-

Example with az cli

az vm list-skus --location westeurope --size Standard_E16bds_v5
...
    "capabilities": [
...
      {
        "name": "DiskControllerTypes",
        "value": "SCSI,NVMe"
      },

If we can get this information from a datasource, we can write code that dynamically prefers the NVMe adapter if available.

This would be very helpful if someone switches the SKU from a NVMe (only) VM size to a SCSI (only) VM size. We can support those SKU changes easier.