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

Suggested resource: postgresql_grant

Open danthegoodman opened this issue 7 years ago • 4 comments

I'd like to have support for managing GRANT and REVOKE statements on individual roles. This could be similar to the mysql_grant resource.

resource "postgresql_grant" "bob-users" {
    role = "bob"
    tables = ["users"]
    privileges = ["SELECT"]
}

resource "postgresql_grant" "bob-sales" {
    role = "bob"
    tables = ["sales"]
    privileges = ["ALL"]
}

There's quite a few combinations of parameters which drive the GRANT command, so this resource could get pretty complicated.

Edit: To end with a question: Is there interest in adding this resource?

danthegoodman avatar Feb 09 '18 18:02 danthegoodman

The created resrource postgresql_grant in #51 only supports ALL TABLES or ALL SEQUENCES of a schema. Is there a plan to support specific table grants as per description above?

andyyaldoo avatar May 13 '19 09:05 andyyaldoo

@adharmawan Yes, I can't really promise when it will be done but it was plan to be done in further iterations.

cyrilgdn avatar May 13 '19 10:05 cyrilgdn

hi @cyrilgdn . Is there any plans to include this feature on the next release? I really need this feature...

galindro avatar Feb 10 '20 13:02 galindro

@jmks is implementing granular grants on tables in https://github.com/terraform-providers/terraform-provider-postgresql/pull/156 👍

robertvanhoesel avatar Jul 23 '20 19:07 robertvanhoesel