In our Azure environment, we utilize Azure DNS Private Resolver with inbound endpoints in a separate spoke VNET. The Hub NGFW Firewall's VNET by default is configured to point to the Default (Azure-provided) DNS servers. Although we can workaround this by setting the DNS servers via the azurerm_virtual_network_dns_servers resource outside of this module, I would like to see support for specifying custom DNS servers natively within this vnet sub-module.
Describe the solution you'd like
Add new optional variable to specify custom DNS servers and update azurerm_virtual_network resource to accept these values.
variable "dns_servers" {
type = list(string)
default = null
}
resource "azurerm_virtual_network" "this" {
count = var.create_virtual_network ? 1 : 0
name = var.name
location = var.region
resource_group_name = var.resource_group_name
address_space = var.address_space
dns_servers = var.dns_servers #<-- set the custom DNS server(s)
tags = var.tags
dynamic "encryption" {
for_each = var.vnet_encryption != null ? [1] : []
content {
enforcement = var.vnet_encryption
}
}
lifecycle {
precondition {
condition = length(coalesce(var.address_space, [])) > 0
error_message = "The `var.address_space` property is required when creating a VNET."
}
}
}
Describe alternatives you've considered.
Use azurerm_virtual_network_dns_servers resource outside of this module.
Is your feature request related to a problem?
In our Azure environment, we utilize Azure DNS Private Resolver with inbound endpoints in a separate spoke VNET. The Hub NGFW Firewall's VNET by default is configured to point to the
Default (Azure-provided)
DNS servers. Although we can workaround this by setting the DNS servers via theazurerm_virtual_network_dns_servers
resource outside of this module, I would like to see support for specifying custom DNS servers natively within thisvnet
sub-module.Describe the solution you'd like
Add new optional variable to specify custom DNS servers and update
azurerm_virtual_network
resource to accept these values.Describe alternatives you've considered.
Use
azurerm_virtual_network_dns_servers
resource outside of this module.Additional context
No response