From 35832ba45d017db948363c7a25187776d1359cd0 Mon Sep 17 00:00:00 2001 From: Jonathan Moss Date: Wed, 19 Aug 2026 18:32:13 -0400 Subject: [PATCH] RELOPS-2410 add trusted ARM template 2.0 --- .../azure_trusted_fxci/template_specs.tf | 15 + .../taskcluster-arm-template-2.0.json | 264 ++++++++++++++++++ 2 files changed, 279 insertions(+) create mode 100644 terraform/azure_trusted_fxci/template_specs/taskcluster-arm-template-2.0.json diff --git a/terraform/azure_trusted_fxci/template_specs.tf b/terraform/azure_trusted_fxci/template_specs.tf index 676fccb6..55591fbd 100644 --- a/terraform/azure_trusted_fxci/template_specs.tf +++ b/terraform/azure_trusted_fxci/template_specs.tf @@ -44,6 +44,21 @@ resource "azapi_resource" "template_spec_version_taskcluster_arm_template_1_0" { depends_on = [azapi_resource.template_spec_taskcluster_arm_template] } +resource "azapi_resource" "template_spec_version_taskcluster_arm_template_2_0" { + type = "Microsoft.Resources/templateSpecs/versions@2022-02-01" + name = "2.0" + parent_id = local.trusted_fxci_template_spec_ids.taskcluster_arm_template + location = "eastus" + + body = { + properties = { + mainTemplate = jsondecode(file("${path.module}/template_specs/taskcluster-arm-template-2.0.json")) + } + } + + depends_on = [azapi_resource.template_spec_taskcluster_arm_template] +} + resource "azapi_resource" "template_spec_version_taskcluster_arm_template_relops_1_0" { type = "Microsoft.Resources/templateSpecs/versions@2022-02-01" name = "1.0" diff --git a/terraform/azure_trusted_fxci/template_specs/taskcluster-arm-template-2.0.json b/terraform/azure_trusted_fxci/template_specs/taskcluster-arm-template-2.0.json new file mode 100644 index 00000000..4c7e3eaa --- /dev/null +++ b/terraform/azure_trusted_fxci/template_specs/taskcluster-arm-template-2.0.json @@ -0,0 +1,264 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "2.0.0.0", + "outputs": { + "resourceIds": { + "type": "object", + "value": { + "nic": "[variables('nicId')]", + "osDisk": "[resourceId('Microsoft.Compute/disks', variables('osDiskName'))]", + "privateIp": "[reference(resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))).ipConfigurations[0].properties.privateIPAddress]", + "publicIp": "[if(parameters('createPublicIp'), variables('publicIpId'), '')]", + "vm": "[resourceId('Microsoft.Compute/virtualMachines', parameters('vmName'))]" + } + } + }, + "parameters": { + "adminPassword": { + "metadata": { + "description": "Admin password (provided by worker-manager)" + }, + "type": "securestring" + }, + "adminUsername": { + "metadata": { + "description": "Admin username (provided by worker-manager)" + }, + "type": "string" + }, + "computerName": { + "metadata": { + "description": "Name of the computer name (osProfile, provided by worker-manager)" + }, + "type": "string" + }, + "createPublicIp": { + "defaultValue": false, + "metadata": { + "description": "Create a public IP for the VM" + }, + "type": "bool" + }, + "customData": { + "metadata": { + "description": "Custom data attached to osProfile (provided by worker-manager)" + }, + "type": "string" + }, + "diffDiskOption": { + "allowedValues": [ + "Local" + ], + "defaultValue": "Local", + "metadata": { + "description": "Ephemeral OS disk option" + }, + "type": "string" + }, + "diffDiskPlacement": { + "allowedValues": [ + "", + "CacheDisk", + "ResourceDisk", + "NvmeDisk" + ], + "defaultValue": "", + "metadata": { + "description": "Ephemeral OS disk placement. Leave this value empty to let Azure select the placement." + }, + "type": "string" + }, + "enableFullCaching": { + "defaultValue": false, + "metadata": { + "description": "Enable full caching for the ephemeral OS disk" + }, + "type": "bool" + }, + "evictionPolicy": { + "allowedValues": [ + "Deallocate", + "Delete" + ], + "defaultValue": "Delete", + "metadata": { + "description": "Eviction policy for Spot VMs" + }, + "type": "string" + }, + "imageId": { + "metadata": { + "description": "Full resource ID of the VM image" + }, + "type": "string" + }, + "location": { + "defaultValue": "eastus", + "metadata": { + "description": "Azure region for the VM" + }, + "type": "string" + }, + "osDiskCaching": { + "allowedValues": [ + "None", + "ReadOnly", + "ReadWrite" + ], + "defaultValue": "ReadOnly", + "metadata": { + "description": "OS disk caching mode" + }, + "type": "string" + }, + "priority": { + "allowedValues": [ + "Regular", + "Spot" + ], + "defaultValue": "Spot", + "metadata": { + "description": "VM priority (Spot or Regular)" + }, + "type": "string" + }, + "subnetId": { + "metadata": { + "description": "Full resource ID of the subnet" + }, + "type": "string" + }, + "tags": { + "defaultValue": {}, + "metadata": { + "description": "Tags to apply to all resources" + }, + "type": "object" + }, + "vmName": { + "metadata": { + "description": "Name of the virtual machine (provided by worker-manager)" + }, + "type": "string" + }, + "vmSize": { + "defaultValue": "Standard_F16s_v2", + "metadata": { + "description": "VM size" + }, + "type": "string" + } + }, + "resources": [ + { + "apiVersion": "2023-05-01", + "condition": "[parameters('createPublicIp')]", + "location": "[parameters('location')]", + "name": "[variables('publicIpName')]", + "properties": { + "publicIPAddressVersion": "IPv4", + "publicIPAllocationMethod": "Static" + }, + "sku": { + "name": "Standard" + }, + "tags": "[parameters('tags')]", + "type": "Microsoft.Network/publicIPAddresses" + }, + { + "apiVersion": "2023-05-01", + "dependsOn": [ + "[variables('publicIpId')]" + ], + "location": "[parameters('location')]", + "name": "[variables('nicName')]", + "properties": { + "ipConfigurations": [ + { + "name": "ipconfig1", + "properties": { + "privateIPAllocationMethod": "Dynamic", + "publicIPAddress": "[if(parameters('createPublicIp'), variables('publicIPConfig'), json('null'))]", + "subnet": { + "id": "[parameters('subnetId')]" + } + } + } + ] + }, + "tags": "[parameters('tags')]", + "type": "Microsoft.Network/networkInterfaces" + }, + { + "apiVersion": "2025-04-01", + "dependsOn": [ + "[variables('nicId')]" + ], + "location": "[parameters('location')]", + "name": "[parameters('vmName')]", + "properties": { + "billingProfile": "[if(equals(parameters('priority'), 'Spot'), createObject('maxPrice', -1), json('null'))]", + "diagnosticsProfile": { + "bootDiagnostics": { + "enabled": false + } + }, + "evictionPolicy": "[if(equals(parameters('priority'), 'Spot'), parameters('evictionPolicy'), json('null'))]", + "hardwareProfile": { + "vmSize": "[parameters('vmSize')]" + }, + "networkProfile": { + "networkInterfaces": [ + { + "id": "[variables('nicId')]", + "properties": { + "deleteOption": "Delete" + } + } + ] + }, + "osProfile": { + "adminPassword": "[parameters('adminPassword')]", + "adminUsername": "[parameters('adminUsername')]", + "computerName": "[parameters('computerName')]", + "windowsConfiguration": { + "enableAutomaticUpdates": false, + "timeZone": "UTC" + } + }, + "priority": "[parameters('priority')]", + "storageProfile": { + "imageReference": { + "id": "[parameters('imageId')]" + }, + "osDisk": { + "caching": "[parameters('osDiskCaching')]", + "createOption": "FromImage", + "deleteOption": "Delete", + "diffDiskSettings": "[union(createObject('option', parameters('diffDiskOption')), if(empty(parameters('diffDiskPlacement')), createObject(), createObject('placement', parameters('diffDiskPlacement'))), if(parameters('enableFullCaching'), createObject('enableFullCaching', parameters('enableFullCaching')), createObject()))]", + "managedDisk": { + "storageAccountType": "Standard_LRS" + }, + "name": "[variables('osDiskName')]", + "osType": "Windows" + } + } + }, + "tags": "[parameters('tags')]", + "type": "Microsoft.Compute/virtualMachines" + } + ], + "variables": { + "nicId": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]", + "nicName": "[concat(parameters('vmName'), '-nic')]", + "osDiskName": "[concat(parameters('vmName'), '-osdisk')]", + "publicIPConfig": { + "id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIpName'))]", + "properties": { + "deleteOption": "Delete" + } + }, + "publicIpId": "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIpName'))]", + "publicIpName": "[concat(parameters('vmName'), '-ip')]" + } +}