I have create Azure postgresql flexible server and trying to delete it, but not able to delete. Getting error as server busy with other operations. How can i resolve and delete this flexible server

Ansar Shaik 0 Reputation points
2024-12-11T04:21:04.89+00:00
resource "azurerm_subnet" "PrivateSubnet1C" {
  name = "PrivateSubnet1C"
  resource_group_name = azurerm_resource_group.fua_group.name
  virtual_network_name = azurerm_virtual_network.fuaVNet.name
  address_prefixes = ["10.130.59.0/24"]
  service_endpoints = ["Microsoft.Storage"]
   delegation {
    name = "fs"
    service_delegation {
      name = "Microsoft.DBforPostgreSQL/flexibleServers"
      actions = [
        "Microsoft.Network/virtualNetworks/subnets/join/action",
      ]
    }
  }
  depends_on = [ azurerm_virtual_network.fuaVNet ]
}

# Private DNS Zone for PostgreSQL (In backup region)
resource "azurerm_private_dns_zone" "fuapostgres_dns" {
  name                = "privatelink.postgres.database.azure.com"
  resource_group_name = azurerm_resource_group.fua_group.name
}

resource "azurerm_private_dns_zone_virtual_network_link" "fuapostgres_dns_link" {
  name                  = "fuapostgres_dns_link"
  private_dns_zone_name = azurerm_private_dns_zone.fuapostgres_dns.name
  resource_group_name   = azurerm_resource_group.fua_group.name
  virtual_network_id    = azurerm_virtual_network.fuaVNet.id
  depends_on = [ azurerm_subnet.PrivateSubnet1C ]
}

resource "azurerm_postgresql_flexible_server" "fuaAuthdb_postgres_writer" {
  name                   = "fuaauthdbpostgreswriter"
  location               = azurerm_resource_group.fua_group.location
  resource_group_name    = azurerm_resource_group.fua_group.name
  sku_name               = "GP_Standard_D8ds_v5"     #"MO_Standard_E48ds_v5" # General Purpose, 8 vCores, 32 GiB RAM "GP_Standard_D8ds_v5"
  storage_mb             = 32768               # 128 GiB
  # storage_tier           = "P4"
  version                = "16"
  administrator_login    = "XXXXXXXXXXX"
  administrator_password = "XXXXXXXXXXX"
  backup_retention_days  = 7
  zone                   = "1"                  # Primary zone
  geo_redundant_backup_enabled = false
  
  
  high_availability {
    mode                       = "ZoneRedundant" # Enable Zone Redundant High Availability
    standby_availability_zone  = "2"            # Standby zone
  }
#   Disable Public Network Access
#   public_network_access_enabled = false
  
  lifecycle {
    ignore_changes = [
      high_availability,
      high_availability[0].standby_availability_zone
    ]
  }

  delegated_subnet_id   = azurerm_subnet.PrivateSubnet1C.id
#   private_dns_zone_id   = azurerm_private_dns_zone.fuapostgres_dns.id
  depends_on = [
    azurerm_private_dns_zone_virtual_network_link.fuapostgres_dns_link,
    azurerm_subnet.PrivateSubnet1C,
    azurerm_network_security_group.PrivateSubnet1C_NSG
  ]
  tags = {
    name = "fuaAuthdb_primary_postgres_writer"
  }
#   timeouts {
#     create                = "120m"  # Extend the creation time to 45 minutes
#   }

}

to this i have successfully created flexible server. but when i try to delete it facing error as "server busy". 
az resource delete --ids /subscriptions/XXXXXXXXX-2d7b-4517-b661-15df3d28be96/resourceGroups/fua_group/providers/Microsoft.DBforPostgreSQL/fuaauthdbpostgreswriter (ServerBusy) Server 'fuaauthdbpostgreswriter' is busy with another operation. Please try again later. Code: ServerBusy Message: Server 'fuaauthdbpostgreswriter' is busy with another operation. Please try again later. PS C:\Users\ansarbashas\OneDrive -

and there are no lock dependencies also. can any one of you please help me to delete it.
Thank you.
Azure Database for PostgreSQL
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.