generated from hashicorp/packer-plugin-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable SecurityProfile (TrustedLaunch) for Virtual Machines (#257)
* Add Trusted Launch feature * Simplify logic * Remove if condtions all together * Added Test for Trusted Launch === RUN TestTrustedLaunch01 --- PASS: TestTrustedLaunch01 (0.00s) PASS ok github.com/hashicorp/packer-plugin-azure/builder/azure/arm 1.721s * Fixed Failing Tests Updated approved JSON following rebase * Added ParameterSet check for Managed Image with vTPM or SecureBoot enabled * I told you the wrong field for managed images in the PR review, I'm committing directly to your fork, will describe changes in PR comment * And managed image check should be or, neither of these fields are valid when secure boot is set --------- Co-authored-by: Max Lampert <[email protected]> Co-authored-by: Jenna Goldstrich <[email protected]>
- Loading branch information
1 parent
509456e
commit a37666c
Showing
9 changed files
with
323 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
211 changes: 211 additions & 0 deletions
211
builder/azure/arm/template_factory_test.TestTrustedLaunch01.approved.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,211 @@ | ||
{ | ||
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", | ||
"contentVersion": "1.0.0.0", | ||
"parameters": { | ||
"adminPassword": { | ||
"type": "securestring" | ||
}, | ||
"adminUsername": { | ||
"type": "string" | ||
}, | ||
"commandToExecute": { | ||
"type": "string" | ||
}, | ||
"dataDiskName": { | ||
"type": "string" | ||
}, | ||
"dnsNameForPublicIP": { | ||
"type": "string" | ||
}, | ||
"nicName": { | ||
"type": "string" | ||
}, | ||
"nsgName": { | ||
"type": "string" | ||
}, | ||
"osDiskName": { | ||
"type": "string" | ||
}, | ||
"publicIPAddressName": { | ||
"type": "string" | ||
}, | ||
"storageAccountBlobEndpoint": { | ||
"type": "string" | ||
}, | ||
"subnetName": { | ||
"type": "string" | ||
}, | ||
"virtualNetworkName": { | ||
"type": "string" | ||
}, | ||
"vmName": { | ||
"type": "string" | ||
}, | ||
"vmSize": { | ||
"type": "string" | ||
} | ||
}, | ||
"resources": [ | ||
{ | ||
"apiVersion": "[variables('publicIPAddressApiVersion')]", | ||
"location": "[variables('location')]", | ||
"name": "[parameters('publicIPAddressName')]", | ||
"properties": { | ||
"dnsSettings": { | ||
"domainNameLabel": "[parameters('dnsNameForPublicIP')]" | ||
}, | ||
"publicIPAllocationMethod": "[variables('publicIPAddressType')]" | ||
}, | ||
"type": "Microsoft.Network/publicIPAddresses" | ||
}, | ||
{ | ||
"apiVersion": "[variables('virtualNetworksApiVersion')]", | ||
"location": "[variables('location')]", | ||
"name": "[variables('virtualNetworkName')]", | ||
"properties": { | ||
"addressSpace": { | ||
"addressPrefixes": [ | ||
"[variables('addressPrefix')]" | ||
] | ||
}, | ||
"subnets": [ | ||
{ | ||
"name": "[variables('subnetName')]", | ||
"properties": { | ||
"addressPrefix": "[variables('subnetAddressPrefix')]" | ||
} | ||
} | ||
] | ||
}, | ||
"type": "Microsoft.Network/virtualNetworks" | ||
}, | ||
{ | ||
"apiVersion": "[variables('networkInterfacesApiVersion')]", | ||
"dependsOn": [ | ||
"[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]", | ||
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" | ||
], | ||
"location": "[variables('location')]", | ||
"name": "[parameters('nicName')]", | ||
"properties": { | ||
"ipConfigurations": [ | ||
{ | ||
"name": "ipconfig", | ||
"properties": { | ||
"privateIPAllocationMethod": "Dynamic", | ||
"publicIPAddress": { | ||
"id": "[resourceId('Microsoft.Network/publicIPAddresses', parameters('publicIPAddressName'))]" | ||
}, | ||
"subnet": { | ||
"id": "[variables('subnetRef')]" | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"type": "Microsoft.Network/networkInterfaces" | ||
}, | ||
{ | ||
"apiVersion": "[variables('apiVersion')]", | ||
"dependsOn": [ | ||
"[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]" | ||
], | ||
"location": "[variables('location')]", | ||
"name": "[parameters('vmName')]", | ||
"properties": { | ||
"diagnosticsProfile": { | ||
"bootDiagnostics": { | ||
"enabled": false | ||
} | ||
}, | ||
"hardwareProfile": { | ||
"vmSize": "[parameters('vmSize')]" | ||
}, | ||
"networkProfile": { | ||
"networkInterfaces": [ | ||
{ | ||
"id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('nicName'))]" | ||
} | ||
] | ||
}, | ||
"osProfile": { | ||
"adminPassword": "[parameters('adminPassword')]", | ||
"adminUsername": "[parameters('adminUsername')]", | ||
"computerName": "[parameters('vmName')]", | ||
"linuxConfiguration": { | ||
"ssh": { | ||
"publicKeys": [ | ||
{ | ||
"keyData": "", | ||
"path": "[variables('sshKeyPath')]" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"securityProfile": { | ||
"securityType": "TrustedLaunch", | ||
"uefiSettings": { | ||
"secureBootEnabled": true, | ||
"vTpmEnabled": true | ||
} | ||
}, | ||
"storageProfile": { | ||
"imageReference": { | ||
"offer": "ignored00", | ||
"publisher": "ignored00", | ||
"sku": "ignored00", | ||
"version": "latest" | ||
}, | ||
"osDisk": { | ||
"caching": "ReadWrite", | ||
"createOption": "FromImage", | ||
"name": "[parameters('osDiskName')]", | ||
"vhd": { | ||
"uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]" | ||
} | ||
} | ||
} | ||
}, | ||
"type": "Microsoft.Compute/virtualMachines" | ||
}, | ||
{ | ||
"apiVersion": "2022-08-01", | ||
"condition": "[not(empty(parameters('commandToExecute')))]", | ||
"dependsOn": [ | ||
"[resourceId('Microsoft.Compute/virtualMachines/', parameters('vmName'))]" | ||
], | ||
"location": "[variables('location')]", | ||
"name": "[concat(parameters('vmName'), '/extension-customscript')]", | ||
"properties": { | ||
"autoUpgradeMinorVersion": true, | ||
"publisher": "Microsoft.Compute", | ||
"settings": { | ||
"commandToExecute": "[parameters('commandToExecute')]" | ||
}, | ||
"type": "CustomScriptExtension", | ||
"typeHandlerVersion": "1.8" | ||
}, | ||
"type": "Microsoft.Compute/virtualMachines/extensions" | ||
} | ||
], | ||
"variables": { | ||
"addressPrefix": "10.0.0.0/16", | ||
"apiVersion": "2020-12-01", | ||
"location": "[resourceGroup().location]", | ||
"managedDiskApiVersion": "2017-03-30", | ||
"networkInterfacesApiVersion": "2017-04-01", | ||
"networkSecurityGroupsApiVersion": "2019-04-01", | ||
"publicIPAddressApiVersion": "2017-04-01", | ||
"publicIPAddressType": "Dynamic", | ||
"sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]", | ||
"subnetAddressPrefix": "10.0.0.0/24", | ||
"subnetName": "[parameters('subnetName')]", | ||
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]", | ||
"virtualNetworkName": "[parameters('virtualNetworkName')]", | ||
"virtualNetworkResourceGroup": "[resourceGroup().name]", | ||
"virtualNetworksApiVersion": "2017-04-01", | ||
"vmStorageAccountContainerName": "images", | ||
"vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters