Unable to connect with Azure postgres with Terraform

Nitin Naidu (Consultant) 46 Reputation points

Getting below error while trying to connect to postgres with terraform. pls help.

Error: error detecting capabilities: error PostgreSQL version: dial tcp XX.XXX.XXX.XXX:5432: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

Azure Database for PostgreSQL
{count} votes

2 answers

Sort by: Most helpful
  1. Nitin Naidu (Consultant) 46 Reputation points
    provider "postgresql" {
      host      = var.postgresql_user_server_fqdn
      port      = 5432
      username  = var.administrator_login
      password  = var.administrator_password
      sslmode   = "require"
      superuser = false
      alias = "create_user"
    I am using this provider block to connect to postgresql every time. It give the mentioned error occasionally at different interval and goes away automatically. Please help.
    0 comments No comments

  2. GeethaThatipatri-MSFT 27,002 Reputation points Microsoft Employee

    @Nitin Naidu (Consultant) This seems you are using the postgresql provider. Seems hashicorp doesn’t maintain/support it for a long time. You can see more details here. Suggest using “azurerm_postgresql_flexible_server” and “azurerm_postgresql_server” in terraform azurerm provider.

    Hope this information helps