hashicorp / terraform-provider-postgresql

As part of our introduction to self-service publishing in the Terraform Registry, this copy of the provider has been archived, and ownership has been transferred to active maintainers in the community. Please see the new location on the Terraform Registry: https://registry.terraform.io/providers/cyrilgdn/postgresql
https://github.com/cyrilgdn/terraform-provider-postgresql
Mozilla Public License 2.0
103 stars 79 forks source link

Ability to grant role membership to existing user #154

Open mikkoc opened 4 years ago

mikkoc commented 4 years ago

Is there a way to grant role membership to an existing user that is not created by Terraform?

I cannot seem to find any.

To be clear, I'd like to run something like this:

GRANT admins TO joe;

via Terraform. But this resource: https://www.terraform.io/docs/providers/postgresql/r/postgresql_grant.html seems focused only on Databases.

The user in question is the RDS master user, which is created automatically by RDS: we cannot create it in Terraform.

Thanks

Vince-Chenal commented 4 years ago

Hello, I started to write something to support this but I don't really know if I chose the good way.

Can anyone have a look at this branch I have ? The idea is to create a new resource "grant_role".

add-grant-role-resource

It's not finished yet but I would prefer to gather opinions before continuing

k911 commented 4 years ago

We've also encountered this issue while trying to manage RDS db via postgres provider. RDS master user is created and managed by AWS. @Vince-Chenal personally, I really like the idea.

pacecreative commented 4 years ago

This would be incredibly helpful as this is the only step remaining that I need to be able to implement terraform with our postgresql instance.