Skip to content
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

Update document for postgresql_default_privileges resource #467

Open
caodangtinh opened this issue Sep 11, 2024 · 1 comment
Open

Update document for postgresql_default_privileges resource #467

caodangtinh opened this issue Sep 11, 2024 · 1 comment

Comments

@caodangtinh
Copy link

caodangtinh commented Sep 11, 2024

Hi, the documentation of the owner, role and privileges arguments in the postgresql_default_privileges resource is quite unclear now.
Current documentation

role - (Required) The name of the role to which grant default privileges on.

owner - (Required) Role for which apply default privileges (You can change default privileges only for objects that will be created by yourself or by roles that you are a member of).

privileges - (Required) The list of privileges to apply as default privileges. An empty list could be provided to revoke all default privileges for this role.

Suggest documentation

role - (Required) The role that will automatically be granted the specified privileges on new objects created by the owner.

owner - (Required) Specifies the role that creates objects for which the default privileges will be applied. You can change default privileges only for objects that will be created by yourself or by roles that you are a member of.

privileges - (Required) List of privileges (e.g., SELECT, INSERT, UPDATE, DELETE) to grant on new objects created by the owner. An empty list could be provided to revoke all default privileges for this role.

Add a new example for granting privileges.

Grant default privileges for tables to "current_role" role:

resource "postgresql_default_privileges" "grant_table_privileges" {
  database    = postgresql_database.example_db.name
  role        = "current_role"
  owner       = "owner_role"
  schema      = "public"
  object_type = "table"
  privileges  = ["SELECT", "INSERT", "UPDATE"]
}

Whenever the owner_role creates a new table in the public schema, the current_role is automatically granted SELECT, INSERT, and UPDATE privileges on that table.

@caodangtinh
Copy link
Author

Pull Request: #468

@caodangtinh caodangtinh changed the title Update document about owner tag in postgresql_default_privileges Update document for postgresql_default_privileges resource Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant