hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.61k stars 4.65k forks source link

Unable to create MySQL flexible server without vnet link in centralized DNS Architecture #28079

Open hardik-id opened 1 week ago

hardik-id commented 1 week ago

Is there an existing issue for this?

Community Note

Creating MySQL Flexible Server fails. Error "VnetNotLinkedToPrivateDnsZone" I am following Centrlized DNS Architecture https://learn.microsoft.com/en-us/azure/dns/private-resolver-architecture#centralized-dns-architecture

That means,

This configuration allows me to create private link of Key Vault in Hub without linking private DNS zone to spoke vnet. But the same configuration fails when I try to create the private link to MySQL Flexible server

resource "azurerm_mysql_flexible_server" "mysql_server" {
  name                              = "test"
  location                          = var.location
  resource_group_name               = var.rg_name
  administrator_login               = var.administrator_login
  administrator_password            = module.password.password
  backup_retention_days             = 7
  delegated_subnet_id               = var.private_endpoints_subnet_id
  geo_redundant_backup_enabled      = true
  private_dns_zone_id               = data.azurerm_private_dns_zone.private_dns_mysql_server.id
  sku_name                          = "GP_Standard_D2ds_v4"
  version                           = "8.0.21"
  zone                              = "1"

Terraform Version

1.9.8

AzureRM Provider Version

3.116.0

Affected Resource(s)/Data Source(s)

azurerm_mysql_flexible_server

Terraform Configuration Files

resource "azurerm_mysql_flexible_server" "mysql_server" {
  name                              = "test"
  location                          = var.location
  resource_group_name               = var.rg_name
  administrator_login               = var.administrator_login
  administrator_password            = module.password.password
  backup_retention_days             = 7
  delegated_subnet_id               = var.private_endpoints_subnet_id
  geo_redundant_backup_enabled      = true
  private_dns_zone_id               = data.azurerm_private_dns_zone.private_dns_mysql_server.id
  sku_name                          = "GP_Standard_D2ds_v4"
  version                           = "8.0.21"
  zone                              = "1"

Debug Output/Panic Output

│ Status: "VnetNotLinkedToPrivateDnsZone"
│ Code: ""
│ Message: "The virtual network 'vnet-spk-nonprod' is not linked to private DNS zone 'privatelink.mysql.database.azure.com'. Please link the virtual network to zone and retry."
│ Activity Id: ""

Expected Behaviour

It should allow the creation of a MySQL private link without linking the vent to a private DNS zone.

Actual Behaviour

fails with error VnetNotLinkedToPrivateDnsZone

Steps to Reproduce

No response

Important Factoids

No response

References

No response

neil-yechenwei commented 1 week ago

Thanks for raising this issue. It's by service API design. Suggest to file Azure Support Ticket for this feature request.