cyrilgdn / terraform-provider-postgresql

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

postgresql_publication: assume owner's role before creating publication #331

Closed Anton-Shutik closed 9 months ago

Anton-Shutik commented 11 months ago

Fixes #330

In order to create publication with owner different from current user, it assumes that owner before publication creation, instead of creating publication with current user (which might not have permissions for that) and updating the publication ownership

Anton-Shutik commented 11 months ago

@cyrilgdn Would you might taking a look ?

I think that approach could be applied to another resources as well.

In my case, default user (which is declared on provider) just manages another users/roles and their permissions and it does not manage databases, tables, publications, subscriptions and so on. But it should be able to _assume databaseuser and manage database objects on behalf of it.

Or may be we can add optional assume_role parameter to resources like database, schema, table, publication and so on. This way we can control the resources on behalf of user other than default (provider's) user.

jpo-tu commented 5 months ago

Why is the diff empty?