Azure / terraform-azurerm-avm-res-network-virtualnetwork

Azure Verified Module for Virtual Network
https://registry.terraform.io/modules/Azure/avm-res-network-virtualnetwork
MIT License
28 stars 22 forks source link

[AVM Module Issue]: Why is resource "azapi_resource" "vnet" being used instead of azurerm_virtual_network Terraform resource #169

Closed ritesh-modi closed 1 hour ago

ritesh-modi commented 4 hours ago

Check for previous/existing GitHub issues

Issue Type?

Feature Request

(Optional) Module Version

No response

(Optional) Correlation Id

No response

Description

The current module is using azapi_resource to provision a virtual network. What is the compelling reason to use azapi_resource instead of azurerm_virtual_network Terraform resource. It would be lot better and predicatable to use azurerm_virtual_network Terraform resource rather than azapi_resource. Can you provide some insights on this?

jaredfholgate commented 1 hour ago

With regards to using azapi, it we originally made that change to meet customer requirements. One example being customers that have a DENY policy on creating a subnet without an NSG. This is impossible with azurerm since it creates the subnet and assigns the NSG in two separate operations, whereas azapi creates the subnet with the NSG in a single operation. We also wanted to support cross subscription peering in a single module, which is also not possible with azurerm.

Given this is a question and we are have no plans to revert back to azurerm, I will close this for now.

I am helping the author with their actual problem on an internal chat.