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

Can't set specific database to postgresql_server

Open damour opened this issue 1 year ago • 4 comments

Affected Resource(s)

  • postgresql_server
resource "postgresql_server" "myserver_postgres" {
  server_name = "myserver_postgres"
  fdw_name    = "postgres_fdw"
  options = {
    host   = "foo"
    dbname = "foodb"
    port   = "5432"
  }

  depends_on = [postgresql_extension.ext_postgres_fdw]
}

Expected Behavior

I can set database in postgresql_server:

resource "postgresql_server" "myserver_postgres_selected_db" {
  server_name = "myserver_postgres"
  database    = "my_db"
  fdw_name    = "postgres_fdw"
  options = {
    host   = "foo"
    dbname = "foodb"
    port   = "5432"
  }

  depends_on = [postgresql_extension.ext_postgres_fdw]
}

Like in extension:

resource "postgresql_extension" "ext_postgres_fdw" {
  name = "postgres_fdw"
  database = "my_db"
}

Actual Behavior

What actually happened?

Error:

pq: foreign-data wrapper "postgres_fdw" does not exist

Steps to Reproduce

  1. terraform apply

Important Factoids

I'm using pulumi wrapper github.com/pulumi/pulumi-postgresql

damour avatar Jul 05 '23 09:07 damour

I am experiencing this as a problem, and also experiencing the same thing on the postgresql_user_mapping resource.

mwthink avatar Sep 05 '23 21:09 mwthink

Also having this experience with postgresql_server and postgresql_user_mapping. Has anyone found a workaround?

jmacnett avatar Apr 26 '24 14:04 jmacnett

I am encountering this same issue with the latest provider version.

henworth avatar Jun 07 '24 20:06 henworth