# Unable to create postgres database in azure

**URL:** <https://discuss.hashicorp.com/t/unable-to-create-postgres-database-in-azure/34562>\
**Category:** Azure\
**Created:** [January 21, 2022, 9:52am UTC](https://discuss.hashicorp.com/t/unable-to-create-postgres-database-in-azure/34562 "2022-01-21T09:52:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ukreddy-erwin](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/ukreddy-erwin/32/7827_2.png) [@ukreddy-erwin](https://discuss.hashicorp.com/u/ukreddy-erwin)\
**Post date:** [January 21, 2022, 9:52am UTC](https://discuss.hashicorp.com/t/unable-to-create-postgres-database-in-azure/34562/1 "2022-01-21T09:52:33Z")

</div>

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" {
    │

╵
```

---

<div class="post-metadata">

**Author:** ![sukanya.das](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/sukanya.das/32/24045_2.png) [@sukanya.das](https://discuss.hashicorp.com/u/sukanya.das)\
**Post date:** [June 10, 2022, 4:57am UTC](https://discuss.hashicorp.com/t/unable-to-create-postgres-database-in-azure/34562/2 "2022-06-10T04:57:12Z")

</div>

I am facing similar error. Few weeks ago the code worked fine, but right now it is giving error while creating the database. Any suggestions why this is happening?
