cyrilgdn / terraform-provider-postgresql

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

[Feature Request] When changing owner of database, change ownership of all objects by providing an additional flag #439

Open lukaalba opened 1 month ago

lukaalba commented 1 month ago

Hi there,

I would like to request an additional flag for the postgresql_database-resource. Although it is possible to change the owner of the database itself with this resource, the owner of already created tables or sequences in this database is not altered. I would like to suggest an additional flag to be able to alter those objects, too, e.g.:

Terraform Configuration Files

resource "postgresql_database" "my_db" {
  name              = "my_db"
  owner             = "my_role"
  template          = "template0"
  lc_collate        = "C"
  connection_limit  = -1
  allow_connections = true
  alter_object_ownership = true
}

If this feature request turns out to be useful, I am happy to provide a PR.