GrantRole

The postgresql.GrantRole resource creates and manages membership in a role to one or more other roles in a non-authoritative way.

When using postgresql.GrantRole resource it is likely because the PostgreSQL role you are modifying was created outside of this provider.

Note: This resource needs PostgreSQL version 9 or above.

Note: postgresql.GrantRole cannot be used in conjunction with postgresql.Role or they will fight over what your role grants should be.

Usage

import * as pulumi from "@pulumi/pulumi";
import * as postgresql from "@pulumi/postgresql";

const grantRoot = new postgresql.GrantRole("grant_root", {
    grantRole: "application",
    role: "root",
    withAdminOption: true,
});
import pulumi
import pulumi_postgresql as postgresql

grant_root = postgresql.GrantRole("grantRoot",
    grant_role="application",
    role="root",
    with_admin_option=True)
using Pulumi;
using PostgreSql = Pulumi.PostgreSql;

class MyStack : Stack
{
    public MyStack()
    {
        var grantRoot = new PostgreSql.GrantRole("grantRoot", new PostgreSql.GrantRoleArgs
        {
            GrantRole = "application",
            Role = "root",
            WithAdminOption = true,
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-postgresql/sdk/v3/go/postgresql"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := postgresql.NewGrantRole(ctx, "grantRoot", &postgresql.GrantRoleArgs{
			GrantRole:       pulumi.String("application"),
			Role:            pulumi.String("root"),
			WithAdminOption: pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		return nil
	})
}

Create a GrantRole Resource

new GrantRole(name: string, args: GrantRoleArgs, opts?: CustomResourceOptions);
@overload
def GrantRole(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              grant_role: Optional[str] = None,
              role: Optional[str] = None,
              with_admin_option: Optional[bool] = None)
@overload
def GrantRole(resource_name: str,
              args: GrantRoleArgs,
              opts: Optional[ResourceOptions] = None)
func NewGrantRole(ctx *Context, name string, args GrantRoleArgs, opts ...ResourceOption) (*GrantRole, error)
public GrantRole(string name, GrantRoleArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args GrantRoleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args GrantRoleArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args GrantRoleArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args GrantRoleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

GrantRole Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The GrantRole resource accepts the following input properties:

GrantRoleName string
The name of the role that is added to role.
Role string
The name of the role that is granted a new membership.
WithAdminOption bool
Giving ability to grant membership to others or not for role. (Default: false)
GrantRole string
The name of the role that is added to role.
Role string
The name of the role that is granted a new membership.
WithAdminOption bool
Giving ability to grant membership to others or not for role. (Default: false)
grantRole string
The name of the role that is added to role.
role string
The name of the role that is granted a new membership.
withAdminOption boolean
Giving ability to grant membership to others or not for role. (Default: false)
grant_role str
The name of the role that is added to role.
role str
The name of the role that is granted a new membership.
with_admin_option bool
Giving ability to grant membership to others or not for role. (Default: false)

Outputs

All input properties are implicitly available as output properties. Additionally, the GrantRole resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.

Look up an Existing GrantRole Resource

Get an existing GrantRole 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?: GrantRoleState, opts?: CustomResourceOptions): GrantRole
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        grant_role: Optional[str] = None,
        role: Optional[str] = None,
        with_admin_option: Optional[bool] = None) -> GrantRole
func GetGrantRole(ctx *Context, name string, id IDInput, state *GrantRoleState, opts ...ResourceOption) (*GrantRole, error)
public static GrantRole Get(string name, Input<string> id, GrantRoleState? 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:

GrantRoleName string
The name of the role that is added to role.
Role string
The name of the role that is granted a new membership.
WithAdminOption bool
Giving ability to grant membership to others or not for role. (Default: false)
GrantRole string
The name of the role that is added to role.
Role string
The name of the role that is granted a new membership.
WithAdminOption bool
Giving ability to grant membership to others or not for role. (Default: false)
grantRole string
The name of the role that is added to role.
role string
The name of the role that is granted a new membership.
withAdminOption boolean
Giving ability to grant membership to others or not for role. (Default: false)
grant_role str
The name of the role that is added to role.
role str
The name of the role that is granted a new membership.
with_admin_option bool
Giving ability to grant membership to others or not for role. (Default: false)

Package Details

Repository
https://github.com/pulumi/pulumi-postgresql
License
Apache-2.0
Notes
This Pulumi package is based on the postgresql Terraform Provider.