Grant
The postgresql..Grant resource creates and manages privileges given to a user for a database schema.
Note: This resource needs Postgresql version 9 or above.
Usage
import * as pulumi from "@pulumi/pulumi";
import * as postgresql from "@pulumi/postgresql";
const readonlyTables = new postgresql.Grant("readonly_tables", {
database: "test_db",
objectType: "table",
privileges: ["SELECT"],
role: "test_role",
schema: "public",
});import pulumi
import pulumi_postgresql as postgresql
readonly_tables = postgresql.Grant("readonlyTables",
database="test_db",
object_type="table",
privileges=["SELECT"],
role="test_role",
schema="public")using Pulumi;
using PostgreSql = Pulumi.PostgreSql;
class MyStack : Stack
{
public MyStack()
{
var readonlyTables = new PostgreSql.Grant("readonlyTables", new PostgreSql.GrantArgs
{
Database = "test_db",
ObjectType = "table",
Privileges =
{
"SELECT",
},
Role = "test_role",
Schema = "public",
});
}
}
Create a Grant Resource
new Grant(name: string, args: GrantArgs, opts?: CustomResourceOptions);def Grant(resource_name, opts=None, database=None, object_type=None, privileges=None, role=None, schema=None, with_grant_option=None, __props__=None);public Grant(string name, GrantArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args GrantArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args GrantArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args GrantArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
Grant Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The Grant resource accepts the following input properties:
- Database string
The database to grant privileges on for this role.
- Object
Type string The PostgreSQL object type to grant the privileges on (one of: table, sequence).
- Privileges List<string>
The list of privileges to grant.
- Role string
The name of the role to grant privileges on.
- Schema string
The database schema to grant privileges on for this role.
- With
Grant boolOption Permit the grant recipient to grant it to others
- Database string
The database to grant privileges on for this role.
- Object
Type string The PostgreSQL object type to grant the privileges on (one of: table, sequence).
- Privileges []string
The list of privileges to grant.
- Role string
The name of the role to grant privileges on.
- Schema string
The database schema to grant privileges on for this role.
- With
Grant boolOption Permit the grant recipient to grant it to others
- database string
The database to grant privileges on for this role.
- object
Type string The PostgreSQL object type to grant the privileges on (one of: table, sequence).
- privileges string[]
The list of privileges to grant.
- role string
The name of the role to grant privileges on.
- schema string
The database schema to grant privileges on for this role.
- with
Grant booleanOption Permit the grant recipient to grant it to others
- database str
The database to grant privileges on for this role.
- object_
type str The PostgreSQL object type to grant the privileges on (one of: table, sequence).
- privileges List[str]
The list of privileges to grant.
- role str
The name of the role to grant privileges on.
- schema str
The database schema to grant privileges on for this role.
- with_
grant_ booloption Permit the grant recipient to grant it to others
Outputs
All input properties are implicitly available as output properties. Additionally, the Grant resource produces the following output properties:
Look up an Existing Grant Resource
Get an existing Grant resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: GrantState, opts?: CustomResourceOptions): Grantstatic get(resource_name, id, opts=None, database=None, object_type=None, privileges=None, role=None, schema=None, with_grant_option=None, __props__=None);func GetGrant(ctx *Context, name string, id IDInput, state *GrantState, opts ...ResourceOption) (*Grant, error)public static Grant Get(string name, Input<string> id, GrantState? state, CustomResourceOptions? opts = null)- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
The following state arguments are supported:
- Database string
The database to grant privileges on for this role.
- Object
Type string The PostgreSQL object type to grant the privileges on (one of: table, sequence).
- Privileges List<string>
The list of privileges to grant.
- Role string
The name of the role to grant privileges on.
- Schema string
The database schema to grant privileges on for this role.
- With
Grant boolOption Permit the grant recipient to grant it to others
- Database string
The database to grant privileges on for this role.
- Object
Type string The PostgreSQL object type to grant the privileges on (one of: table, sequence).
- Privileges []string
The list of privileges to grant.
- Role string
The name of the role to grant privileges on.
- Schema string
The database schema to grant privileges on for this role.
- With
Grant boolOption Permit the grant recipient to grant it to others
- database string
The database to grant privileges on for this role.
- object
Type string The PostgreSQL object type to grant the privileges on (one of: table, sequence).
- privileges string[]
The list of privileges to grant.
- role string
The name of the role to grant privileges on.
- schema string
The database schema to grant privileges on for this role.
- with
Grant booleanOption Permit the grant recipient to grant it to others
- database str
The database to grant privileges on for this role.
- object_
type str The PostgreSQL object type to grant the privileges on (one of: table, sequence).
- privileges List[str]
The list of privileges to grant.
- role str
The name of the role to grant privileges on.
- schema str
The database schema to grant privileges on for this role.
- with_
grant_ booloption Permit the grant recipient to grant it to others
Package Details
- Repository
- https://github.com/pulumi/pulumi-postgresql
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
postgresqlTerraform Provider.