-
Notifications
You must be signed in to change notification settings - Fork 79
Improved postgresql_grant #85
Comments
Hi @els-higginsd , The grant resource supports indeed only I'll let you know here as soon I'll be able to work on it. |
+1 GRANT CONNECT ON DATABASE YourDatabaseName TO Read_Only_User; Ref: ansible-postgres-pri |
I would like to see support for granting 'execute' on functions. |
@glerma are there any plans (or interest) in being able to specify grants for specific tables/sequences? For example, RoleA is read-only on all tables in the schema, except it should have INSERT on Table1. |
One more use case for a more generic Thus, to enable one user (call it As superuser:
Then, as
The second statement can be generated by the currently existing What do you think about expanding
|
+1 for this
|
Is it possible to revoke the ability for a read-only user to create database tables in the resource postgresql_schema public {
name = "public"
if_not_exists = true
# This doesn't seem to work. Read-only user can still create tables in 'public' schema.
policy {
create = false
usage = true
role = postgresql_role.read_only.name
}
policy {
create = true
usage = true
role = postgresql_role.admin.name
}
} EDIT: ah, this is because these changes are being applied to the wrong database. See #102 |
for me it's really pain in ass for providing read only access for AWS RDS. |
@solarmosaic-kflorence Did you get the public schema altered so that a read-only role couldn't create tables in it? |
@cyrilgdn I will try to work on adding support for databases in grants. (1) Would you advice to keep a single terraform resource for grants ( Having different resources (2) for grant allows to have more specific parameters for some grants. For instance Keeping a single resource (1) is completely fine, I only want your opinion before going either way. |
@tgermain Many thanks in advance 🙏 I had in mind to have one resource for all types (it already manages tables&sequences), there's already a "allowed privileges per resource map" than can be completed with new types (note that there's a bug with the So you can try like that but it may not be that simple with potential corner cases. So if you find out that having only one resource is way too complex, feel free to propose another solution. |
@mdgreenwald I found out that this is actually default behavior for the
This can be revoked with |
@jeromepin Thanks a lot, I'll take a look as soon as I can 👍 |
Hello, I'm lack the |
+1 for |
We indeed need to implement grant on schema in resource "postgresql_schema" "foo" {
name = "foo"
owner = "XXX"
policy {
role = "YYY"
usage = true
}
} Eventually I would like to deprecate this block in favor of |
@cyrilgdn yeah that's what I have right now. It works but it makes |
Hi @cyrilgdn |
Terraform Version
v0.11.14
Affected Resource(s)
Please list the resources as a list, for example:
Expected Behavior
Should be able to execute various GRANT statements
Actual Behavior
Only able to execute GRANT on ALL tables or schemas
I have a use-case where I'd like to grant a role the ability to create schemas, but am not able to do so with the current postgresql_grant resource as it is limited to granting permissions to only tables and schemas.
As far as I understand it, I need to run
GRANT CREATE ON DATABASE db TO user;
but I'm unable to find a way to do this with the current provider.I think a quick fix to this might be to allow
object_type
to either be empty, or support a "db|database" value ... then in the postgresql_grant.go the statement would be generated more like this:This would then allow us to generate
GRANT CREATE ON database TO role;
statements, as well as a few more other options most likely.The text was updated successfully, but these errors were encountered: