» postgresql_grant

The postgresql_grant resource creates and manages privileges given to a user for a database schema.

See PostgreSQL documentation

» Usage

resource "postgresql_grant" "readonly_tables" {
  database    = "test_db"
  role        = "test_role"
  schema      = "public"
  object_type = "table"
  privileges  = ["SELECT"]

» Argument Reference

  • role - (Required) The name of the role to grant privileges on.
  • database - (Required) The database to grant privileges on for this role.
  • schema - (Required) The database schema to grant privileges on for this role.
  • object_type - (Required) The PostgreSQL object type to grant the privileges on (one of: database, table, sequence,function).
  • privileges - (Required) The list of privileges to grant. There are different kinds of privileges: SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER, CREATE, CONNECT, TEMPORARY, EXECUTE, and USAGE.