-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
postgresql_grant resource should allow empty list of privileges #16
Comments
That seems priority number #1. Many people suffers from not being REVOKE public access from database. Only one command is required for us to not use other provision tools. |
After digging a bit on this subject, we need 3 things:
The third one is required for @kamil-rogon-dragon 's example in hashicorp#197 :
Unless I'm wrong, |
You can follow issue #12 for the third point. |
Here is the good example what needs to be done https://aws.amazon.com/blogs/database/managing-postgresql-users-and-roles/ -- Revoke privileges from 'public' role This is top level. And then more granule access is managed by grant to database/schema like CREATE ROLE readonly; |
@cyrilgdn sorry to being pedantic but my request was a little bit different the issues you are working all deal with schema based access like GRANT { { CREATE | USAGE } [, ...] | ALL [ PRIVILEGES ] } But we need also pure database privileges without schema like GRANT { { CREATE | CONNECT | TEMPORARY | TEMP } [, ...] | ALL [ PRIVILEGES ] } I might be wrong and those one can be coveted is schema declaration will be optional in statement resource "postgresql_grant" "readonly_tables" { but it is mandatory schema - (Required) The database schema to grant privileges on for this role. as for today. |
@icterine No problem, you're right I didn't answered fully to your question. Actually what you want is already possible but the documentation is not up to date, I'll fix it. You can write: resource postgresql_database "test" {
name = "test"
}
resource postgresql_role "test_role" {
name = "test_role"
}
resource postgresql_grant "test_role" {
database = postgresql_database.test.name
role = postgresql_role.test_role.name
object_type = "database"
privileges = [
"CREATE",
"CONNECT",
]
} But with
|
Thanks @cyrilgdn . Much appreciated for your help.. |
Replication of hashicorp/terraform-provider-postgresql#197
Being able to execute
REVOKE ALL ON DATABASE XXX FROM PUBLIC
is the one thing we're looking for if a separate, more targeted resource might be more appropriate.The text was updated successfully, but these errors were encountered: