terraform-provider-postgresql icon indicating copy to clipboard operation
terraform-provider-postgresql copied to clipboard

Postgres Compatibility Issue with 11.6

Open miketwenty1 opened this issue 5 years ago • 2 comments

Hi there,

What am I doing wrong, I keep getting a compatibility issue

Terraform Version

Run terraform -v to show the version. If you are not running the latest version of Terraform, please upgrade because your issue may have already been fixed. v0.12.20

Affected Resource(s)

provider "postgresql" resource "postgresql_database"

Expected Behavior

create DB

Actual Behavior

Error

Error: Error initializing PostgreSQL client: error detecting capabilities: error PostgreSQL version: dial tcp :5432: connect: connection refused
   on <empty> line 0:
   (source code not available)

Steps to Reproduce

Please list the steps required to reproduce the issue, for example: db_engine_version = "11.6"

provider "postgresql" {
  host              = module.service_db.address
  port              = 5432
  username          = var.db_username
  password          = module.service_db.password
  expected_version  = var.db_engine_version
  connect_timeout   = 15
  sslmode           = "require"
  alias = "servicedb"
}

miketwenty1 avatar Mar 10 '20 06:03 miketwenty1

Taking out the alias made it work. It's unclear why this would fix the issue. Will leave this open for a while to see if anyone can chime in.

miketwenty1 avatar Mar 10 '20 14:03 miketwenty1

I'm having kinda the same problem but with 10.7 as well. with alias I get

Error: Error initializing PostgreSQL client: error detecting capabilities: error PostgreSQL version: dial tcp :5432: connect: connection refused
  required_providers {
    postgresql = {
      version = "1.7.1"
    }
  }
provider "postgresql" {
  alias     = "main"
  host      = var.postgres_main_host
  port      = var.postgres_main_port
  username  = var.postgres_main_username
  password  = var.postgres_main_password
  superuser = false
}

It's

> terraform version
Terraform v0.12.29
+ provider.postgresql v1.7.1
+ provider.vault v2.12.2

I've tried different provider.postgresql versions starting from 1.5.0

Only removing alias resolves the problem. I'm running this code against 10.7 AWS RDS. Specifying expected_version does not help either.

kostyrev avatar Aug 17 '20 11:08 kostyrev