Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added deleteOption to VM #850

Merged
merged 3 commits into from
Jan 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"osDisk": {
"value": {
"createOption": "fromImage",
"deleteOption": "Delete",
"diskSizeGB": "128",
"managedDisk": {
"storageAccountType": "Premium_LRS"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"osDisk": {
"value": {
"createOption": "fromImage",
"deleteOption": "Delete",
"diskSizeGB": "128",
"managedDisk": {
"storageAccountType": "Premium_LRS"
Expand All @@ -51,6 +52,7 @@
"value": [
{
"nicSuffix": "-nic-01",
"deleteOption": "Delete",
"ipConfigurations": [
{
"name": "ipconfig01",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"osDisk": {
"value": {
"createOption": "fromImage",
"deleteOption": "Delete",
"diskSizeGB": "128",
"managedDisk": {
"storageAccountType": "Premium_LRS"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"osDisk": {
"value": {
"createOption": "fromImage",
"deleteOption": "Delete",
"diskSizeGB": "128",
"managedDisk": {
"storageAccountType": "Premium_LRS"
Expand All @@ -40,6 +41,7 @@
"value": [
{
"nicSuffix": "-nic-01",
"deleteOption": "Delete",
"ipConfigurations": [
{
"name": "ipconfig01",
Expand Down
3 changes: 3 additions & 0 deletions arm/Microsoft.Compute/virtualMachines/deploy.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ resource virtualMachine 'Microsoft.Compute/virtualMachines@2021-07-01' = {
osDisk: {
name: '${name}-disk-os-01'
createOption: osDisk.createOption
deleteOption: contains(osDisk, 'deleteOption') ? osDisk.deleteOption : 'Delete'
diskSizeGB: osDisk.diskSizeGB
managedDisk: {
storageAccountType: osDisk.managedDisk.storageAccountType
Expand All @@ -353,6 +354,7 @@ resource virtualMachine 'Microsoft.Compute/virtualMachines@2021-07-01' = {
name: '${name}-disk-data-${padLeft((index + 1), 2, '0')}'
diskSizeGB: dataDisk.diskSizeGB
createOption: dataDisk.createOption
deleteOption: contains(dataDisk, 'deleteOption') ? dataDisk.deleteOption : 'Delete'
caching: dataDisk.caching
managedDisk: {
storageAccountType: dataDisk.managedDisk.storageAccountType
Expand All @@ -378,6 +380,7 @@ resource virtualMachine 'Microsoft.Compute/virtualMachines@2021-07-01' = {
networkProfile: {
networkInterfaces: [for (nicConfiguration, index) in nicConfigurations: {
properties: {
deleteOption: contains(nicConfiguration, 'deleteOption') ? nicConfiguration.deleteOption : 'Delete'
primary: index == 0 ? true : false
}
id: resourceId('Microsoft.Network/networkInterfaces', '${name}${nicConfiguration.nicSuffix}')
Expand Down
11 changes: 7 additions & 4 deletions arm/Microsoft.Compute/virtualMachines/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ This module deploys one Virtual Machine with one or multiple nics and optionally
"osDisk": {
"value": {
"createOption": "fromImage",
"deleteOption": "Delete", // Optional. Can be 'Delete' or 'Detach'
"diskSizeGB": "128",
"managedDisk": {
"storageAccountType": "Premium_LRS"
Expand All @@ -141,6 +142,7 @@ This module deploys one Virtual Machine with one or multiple nics and optionally
"value": [{
"caching": "ReadOnly",
"createOption": "Empty",
"deleteOption": "Delete", // Optional. Can be 'Delete' or 'Detach'
"diskSizeGB": "256",
"managedDisk": {
"storageAccountType": "Premium_LRS"
Expand Down Expand Up @@ -231,6 +233,7 @@ The field `nicSuffix` and `subnetId` are mandatory. If `enablePublicIP` is set t
"value": [
{
"nicSuffix": "-nic-01",
"deleteOption": "Delete", // Optional. Can be 'Delete' or 'Detach'
"ipConfigurations": [
{
"name": "ipconfig1",
Expand Down Expand Up @@ -512,11 +515,11 @@ You can specify multiple user assigned identities to a resource by providing add

## Template references

- [Locks ](https://docs.microsoft.com/en-us/azure/templates/Microsoft.Authorization/2017-04-01/locks)
- [Roleassignments](https://docs.microsoft.com/en-us/azure/templates/Microsoft.Authorization/2020-04-01-preview/roleAssignments)
- [Virtualmachines](https://docs.microsoft.com/en-us/azure/templates/Microsoft.Compute/2021-07-01/virtualMachines)
- [Virtualmachines/Extensions](https://docs.microsoft.com/en-us/azure/templates/Microsoft.Compute/2021-07-01/virtualMachines/extensions)
- [Diagnosticsettings](https://docs.microsoft.com/en-us/azure/templates/Microsoft.Insights/2021-05-01-preview/diagnosticSettings)
- [Locks](https://docs.microsoft.com/en-us/azure/templates/Microsoft.Authorization/2017-04-01/locks)
- [Networkinterfaces](https://docs.microsoft.com/en-us/azure/templates/Microsoft.Network/2021-03-01/networkInterfaces)
- [Publicipaddresses](https://docs.microsoft.com/en-us/azure/templates/Microsoft.Network/2021-03-01/publicIPAddresses)
- [Roleassignments](https://docs.microsoft.com/en-us/azure/templates/Microsoft.Authorization/2020-04-01-preview/roleAssignments)
- [Vaults/Backupfabrics/Protectioncontainers/Protecteditems](https://docs.microsoft.com/en-us/azure/templates/Microsoft.RecoveryServices/2021-06-01/vaults/backupFabrics/protectionContainers/protectedItems)
- [Virtualmachines](https://docs.microsoft.com/en-us/azure/templates/Microsoft.Compute/2021-07-01/virtualMachines)
- [Virtualmachines/Extensions](https://docs.microsoft.com/en-us/azure/templates/Microsoft.Compute/2021-07-01/virtualMachines/extensions)
6 changes: 0 additions & 6 deletions docs/wiki/KnownIssues.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ This section outlines known issues that currently affect our modules.

This section outlines known issues that currently affect our testing.

## Removal exceptions

Not all modules are removed after their test deployment.

In general, the current approach works for about 99% of the modules. There is one known exception, that is the `osDisk` removal for the virtual machine module, as Azure has difficulties finding it without using direct REST calls.

## Limited parameter file set

We have yet to implement the full set of parameter files we need in order to test all possible scenarios. The most important first step will be a 'minimum-set' parameter file vs. a 'maximum-set' parameter file for each module, followed by parameter files for specific scenarios
Expand Down