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.51k stars 4.6k forks source link

Add hibernation support to azurerm_dev_center_dev_box_definition #26703

Open webstean opened 1 month ago

webstean commented 1 month ago

Is there an existing issue for this?

Community Note

Description

Please add the hibernation support as per azapi:-

resource "azapi_resource" "devbox-defintion-vspro" {
  for_each = azurerm_dev_center.devbox

  type = "Microsoft.DevCenter/devcenters/devboxdefinitions@2023-04-01"
  // eg. Win11-8vcpu
  name      = azurerm_shared_image.vspro[each.key].name
  location  = each.value.location
  parent_id = each.value.id ## devcenter
  tags      = each.value.tags
  body = jsonencode({
    properties = {
      hibernateSupport = "Enabled"
      imageReference = {
        id = format("%s/galleries/default/images/%s_%s_%s", each.value.id, data.azurerm_platform_image.vspro[each.key].publisher, data.azurerm_platform_image.vspro[each.key].offer, data.azurerm_platform_image.vspro[each.key].sku)
      }
      osStorageType = "ssd_512gb"
      ## size of compute
      sku = {
        ## only need with scale out/in
        ## capacity = int

        family = "general_i_v2"
        name   = "general_i_8c32gb512ssd_v2"
        ##        size = "string"
        ##        tier = "Basic" |  "Free" | "Premium" | "Standard"
        ##        tier = "Premium"
      }
    }
  })
  schema_validation_enabled = true
}

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

azurerm_dev_center_dev_box_definition

Potential Terraform Configuration

resource "azurerm_dev_center_dev_box_definition" "example" {
  name               = "example-dcet"
  location           = azurerm_resource_group.example.location
  dev_center_id      = azurerm_dev_center.example.id
  hibernation        = enabled
  image_reference_id = "${azurerm_dev_center.example.id}/galleries/default/images/microsoftvisualstudio_visualstudioplustools_vs-2022-ent-general-win10-m365-gen2"
  sku_name           = "general_i_8c32gb256ssd_v2"
}


### References

_No response_
neil-yechenwei commented 1 month ago

Thanks for raising this issue. The MS Official Doc indicates that this feature is still in preview status. Generally, Terraform doesn't support the preview feature. Once this feature is released as stable feature, then we can take another look. Thanks.

There might be potential regression issues to have AzureRM support Azure preview features, because preview features do not guarantee its backward and forward feature compatibility. E.g. If AzureRM supports it now but this feature will have new versions in the future which however would include breaking changes to the current preview versions, it would be uneasy for AzureRM to catch up with that new version because it's on purpose to bring as few breaking changes as possible to Terraform AzureRM.

Per the perspective of having people experience this feature in TF, Terraform AzAPI provider could be an option.