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

Ability to grant role membership to existing user

Open mikkoc opened this issue 5 years ago • 3 comments

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

mikkoc avatar Jul 02 '20 13:07 mikkoc

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

Vince-Chenal avatar Jul 07 '20 14:07 Vince-Chenal

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.

k911 avatar Aug 12 '20 08:08 k911

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.

pacecreative avatar Sep 01 '20 20:09 pacecreative