Skip to content

[AVM Module Issue]: Missing support for "delete with vm" option on disks and nics #246

@mcdonamw-ews

Description

@mcdonamw-ews

Check for previous/existing GitHub issues

  • I have checked for previous/existing GitHub issues

Issue Type?

Feature Request

(Optional) Module Version

0.20.0

(Optional) Correlation Id

No response

Description

Summary

The module does not currently expose delete_option for the OS disk or network interfaces. Both are configurable in the underlying azurerm_windows_virtual_machine resource and the Azure REST API, but there is no way to set them through the module's input variables.

Missing Properties

OS Disk
The os_disk variable object does not include a delete_option field, which maps to storageProfile.osDisk.deleteOption in the Azure ARM API.

Network Interfaces
The network_interfaces map object does not include a delete_option field per NIC, which maps to networkProfile.networkInterfaces[].deleteOption in the Azure ARM API.

Expected Behavior

Both os_disk and network_interfaces should accept an optional delete_option value of either "Delete" or "Detach", defaulting to "Delete" to align with current Azure portal default behavior for new VMs.

Current Behavior

Both default to Detach, meaning when a VM is destroyed the OS disk and NIC are left behind as orphaned resources requiring manual cleanup.

Use Case

When deploying VMs via Terraform and later running terraform destroy, orphaned disks and NICs remain in the resource group. This requires manual cleanup and can result in unexpected storage costs. The Azure portal now defaults new VMs to Delete for both resources, and matching that behavior in the module would be consistent with current Azure guidance.

Module Version

0.20.0

Provider Version

azurerm >= 3.116, < 5.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions