Open randallt opened 4 months ago
I am able to use ARM Templates as a workaround, of course, but it was not fun since I'd never used them before. For reference:
templates/dedicated_host_group.json:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"resourceName": {
"type": "string",
"metadata": {
"description": "The name of the Host group resource."
}
},
"location": {
"type": "string",
"metadata": {
"description": "The location of the Host group resource."
}
},
"platformFaultDomainCount": {
"type": "string",
"metadata": {
"description": "The platform fault domain count of the Host group resource."
}
},
"zones": {
"type": "array",
"metadata": {
"description": "The availability zone of the Host group resource"
}
},
"ultraSSDEnabled": {
"type": "string",
"metadata": {
"description": "Enable ultra SSD on hosts."
}
}
},
"resources": [
{
"type": "Microsoft.Compute/hostGroups",
"name": "[parameters('resourceName')]",
"apiVersion": "2021-11-01",
"location": "[parameters('location')]",
"properties": {
"platformFaultDomainCount": "[parameters('platformFaultDomainCount')]",
"additionalCapabilities": {
"ultraSSDEnabled": "[parameters('ultraSSDEnabled')]"
}
},
"tags": {},
"zones": "[parameters('zones')]"
}
],
"outputs": {
"hostGroupId": {
"type": "string",
"value": "[resourceId('Microsoft.Compute/hostGroups', parameters('resourceName'))]"
}
}
}
main.tf:
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
}
}
# Configure the Microsoft Azure Provider
provider "azurerm" {
features {
resource_group {
prevent_deletion_if_contains_resources = false
}
}
subscription_id = "<sub_id>"
}
# Azure resource group to hold everything we're doing here
resource "azurerm_resource_group" "resource_group" {
name = "dedicated-host-group-RG"
location = "eastus"
}
resource "azurerm_resource_group_template_deployment" "dedicated_host_group_arm" {
name = "dedicated-host-group"
resource_group_name = azurerm_resource_group.resource_group.name
deployment_mode = "Incremental"
template_content = file("templates/dedicated_host_group.json",)
parameters_content = jsonencode({
"resourceName" = { value = "dedicated-host-group" }
"location" = { value = azurerm_resource_group.resource_group.location }
"platformFaultDomainCount" = { value = "1" }
"zones" = { value = [ "1" ] }
"ultraSSDEnabled" = { value = "true" }
})
}
resource "azurerm_dedicated_host" "dedicated_host" {
name = "dedicated-host"
location = azurerm_resource_group.resource_group.location
dedicated_host_group_id = jsondecode(azurerm_resource_group_template_deployment.dedicated_host_group_arm.output_content).hostGroupId.value
sku_name = "DDSv5-Type1"
platform_fault_domain = 0
auto_replace_on_failure = false
}
# virtual network within the resource group
resource "azurerm_virtual_network" "vnet" {
name = "vnet"
resource_group_name = azurerm_resource_group.resource_group.name
location = azurerm_resource_group.resource_group.location
address_space = ["10.13.0.0/16"]
}
# subnet within the virtual network
resource "azurerm_subnet" "subnet" {
name = "subnet"
resource_group_name = azurerm_resource_group.resource_group.name
virtual_network_name = azurerm_virtual_network.vnet.name
address_prefixes = ["10.13.0.0/24"]
}
# network interface - sv
resource "azurerm_network_interface" "sv_nic" {
name = "sv-NIC"
location = azurerm_resource_group.resource_group.location
resource_group_name = azurerm_resource_group.resource_group.name
ip_configuration {
name = "internal"
subnet_id = azurerm_subnet.subnet.id
private_ip_address_allocation = "Static"
private_ip_address = cidrhost("10.13.0.0/24", 101)
}
}
resource "azurerm_windows_virtual_machine" "vm_sv" {
name = "vm-sv"
location = azurerm_resource_group.resource_group.location
zone = 1
dedicated_host_id = azurerm_dedicated_host.dedicated_host.id
resource_group_name = azurerm_resource_group.resource_group.name
network_interface_ids = [azurerm_network_interface.sv_nic.id]
size = "Standard_D4ds_v5"
admin_username = "superuser"
admin_password = "<*superPassword342*>"
os_disk {
caching = "ReadOnly"
storage_account_type = "Standard_LRS"
diff_disk_settings { # ephemeral OS disk
option = "Local"
placement = "ResourceDisk"
}
}
source_image_reference {
publisher = "MicrosoftWindowsServer"
offer = "WindowsServer"
sku = "2019-datacenter-smalldisk-g2"
version = "17763.5696.240406"
}
additional_capabilities {
ultra_ssd_enabled = "true"
}
}
# managed ultra disk for work dir
resource "azurerm_managed_disk" "work_disk_sv" {
name = "dedicated-host-sv-work-disk"
location = azurerm_resource_group.resource_group.location
zone = 1
resource_group_name = azurerm_resource_group.resource_group.name
storage_account_type = "UltraSSD_LRS"
create_option = "Empty"
disk_size_gb = "4"
on_demand_bursting_enabled = "false"
}
# attach it to the VM
resource "azurerm_virtual_machine_data_disk_attachment" "disk_attachment_sv" {
managed_disk_id = azurerm_managed_disk.work_disk_sv.id
virtual_machine_id = azurerm_windows_virtual_machine.vm_sv.id
lun = "10"
caching = "None"
}
Is there an existing issue for this?
Community Note
Terraform Version
1.6.6
AzureRM Provider Version
3.111.0
Affected Resource(s)/Data Source(s)
azurerm_dedicated_host_group
Terraform Configuration Files
Debug Output/Panic Output
Full debug output not needed. But this is the error message:
There appears to be no way to add the ultra SSD capability to the dedicated host group in terraform at this time.
Expected Behaviour
I should be able to add a block to the dedicated host group, like
Actual Behaviour
I'm not allowed to add the capability to the host group.
Steps to Reproduce
terraform apply
Important Factoids
No response
References
No response