cyrilgdn / terraform-provider-postgresql

Terraform PostgreSQL provider
https://www.terraform.io/docs/providers/postgresql/
Mozilla Public License 2.0
356 stars 181 forks source link

Can't set specific database to postgresql_server #319

Open damour opened 12 months ago

damour commented 12 months ago

Affected Resource(s)

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

mwthink commented 10 months ago

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

jmacnett commented 2 months ago

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

henworth commented 3 weeks ago

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