With azure cli command.
az postgres flexible-server create --resource-group testaksk8s-del --name testaksk8s-del-dev --subnet /subscriptions/f733ab10-e6a2-406d-9c23-cafe4ec0e71e/resourceGroups/testaksk8s-del/providers/Microsoft.Network/virtualNetworks/testaksk8s/subnets/testaksk8s-subnet2 --private-dns-zone /subscriptions/f733ab10-e6a2-406d-9c23-cafe4ec0e71e/resourceGroups/testaksk8s-del-postgres/providers/Microsoft.Network/privateDnsZones/testaksk8s-del-postgres-del.private.postgres.database.azure.com
I am able to create postgres flexible server.
But with below terraform template
resource "azurerm_postgresql_flexible_server" "example" {
name = "testaksk8s-del-dev"
resource_group_name = "testaksk8s-del"
location = "eastus2"
version = "13"
delegated_subnet_id = "/subscriptions/f733ab10-e6a2-406d-9c23-cafe4ec0e71e/resourceGroups/testaksk8s-del/providers/Microsoft.Network/virtualNetworks/testaksk8s/subnets/testaksk8s-subnet2"
private_dns_zone_id = "/subscriptions/f733ab10-e6a2-406d-9c23-cafe4ec0e71e/resourceGroups/testaksk8s-del-postgres/providers/Microsoft.Network/privateDnsZones/testaksk8s-del-postgres-del.private.postgres.database.azure.com"
administrator_login = var.administrator_login
administrator_password = var.administrator_password
zone = "1"
storage_mb = 131072
sku_name = var.postgres_sku #"GP_Standard_D2s_v3"
}
I am getting error as below.
azurerm_kubernetes_cluster.aks_cluster: Creation complete after 3m59s [id=/subscriptions/f733ab10-e6a2-406d-9c23-cafe4ec0e71e/resourceGroups/testaksk8s-del/providers/Microsoft.ContainerService/managedClusters/testaksk8s-del-cluster]
╷
│ Error: waiting for creation of the Postgresql Flexible Server "testaksk8s-del-postgres-del" (Resource Group "testaksk8s-del-postgres"): Code="InternalServerError" Message="An unexpected error occured while processing the request. Tracking ID: '909ed65d-cacb-4f2e-b3f2-ddc743bf8429'"
│
│ with azurerm_postgresql_flexible_server.example,
│ on 12-postgres.tf line 15, in resource "azurerm_postgresql_flexible_server" "example":
│ 15: resource "azurerm_postgresql_flexible_server" "example" {
│
╵