1. Packages
  2. CockroachDB Cloud
  3. API Docs
  4. UserRoleGrant
CockroachDB v0.9.4 published on Friday, Mar 21, 2025 by pulumiverse

cockroach.UserRoleGrant

Explore with Pulumi AI

Example Usage

Coming soon!
Coming soon!
Coming soon!
Coming soon!
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.cockroach.UserRoleGrant;
import com.pulumi.cockroach.UserRoleGrantArgs;
import com.pulumi.cockroach.inputs.UserRoleGrantRoleArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var config = ctx.config();
        final var userId = config.get("userId");
        var adminGrant = new UserRoleGrant("adminGrant", UserRoleGrantArgs.builder()
            .userId(userId)
            .role(UserRoleGrantRoleArgs.builder()
                .role_name("CLUSTER_ADMIN")
                .resource_type("CLUSTER")
                .resource_id(example.id())
                .build())
            .build());

    }
}
Copy
configuration:
  userId:
    type: string
resources:
  adminGrant:
    type: cockroach:UserRoleGrant
    name: admin_grant
    properties:
      userId: ${userId}
      role:
        role_name: CLUSTER_ADMIN
        resource_type: CLUSTER
        resource_id: ${example.id}
Copy

Create UserRoleGrant Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new UserRoleGrant(name: string, args: UserRoleGrantArgs, opts?: CustomResourceOptions);
@overload
def UserRoleGrant(resource_name: str,
                  args: UserRoleGrantArgs,
                  opts: Optional[ResourceOptions] = None)

@overload
def UserRoleGrant(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  role: Optional[UserRoleGrantRoleArgs] = None,
                  user_id: Optional[str] = None)
func NewUserRoleGrant(ctx *Context, name string, args UserRoleGrantArgs, opts ...ResourceOption) (*UserRoleGrant, error)
public UserRoleGrant(string name, UserRoleGrantArgs args, CustomResourceOptions? opts = null)
public UserRoleGrant(String name, UserRoleGrantArgs args)
public UserRoleGrant(String name, UserRoleGrantArgs args, CustomResourceOptions options)
type: cockroach:UserRoleGrant
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. UserRoleGrantArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. UserRoleGrantArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. UserRoleGrantArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. UserRoleGrantArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. UserRoleGrantArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var userRoleGrantResource = new Cockroach.UserRoleGrant("userRoleGrantResource", new()
{
    Role = new Cockroach.Inputs.UserRoleGrantRoleArgs
    {
        ResourceType = "string",
        RoleName = "string",
        ResourceId = "string",
    },
    UserId = "string",
});
Copy
example, err := cockroach.NewUserRoleGrant(ctx, "userRoleGrantResource", &cockroach.UserRoleGrantArgs{
	Role: &cockroach.UserRoleGrantRoleArgs{
		ResourceType: pulumi.String("string"),
		RoleName:     pulumi.String("string"),
		ResourceId:   pulumi.String("string"),
	},
	UserId: pulumi.String("string"),
})
Copy
var userRoleGrantResource = new UserRoleGrant("userRoleGrantResource", UserRoleGrantArgs.builder()
    .role(UserRoleGrantRoleArgs.builder()
        .resourceType("string")
        .roleName("string")
        .resourceId("string")
        .build())
    .userId("string")
    .build());
Copy
user_role_grant_resource = cockroach.UserRoleGrant("userRoleGrantResource",
    role={
        "resource_type": "string",
        "role_name": "string",
        "resource_id": "string",
    },
    user_id="string")
Copy
const userRoleGrantResource = new cockroach.UserRoleGrant("userRoleGrantResource", {
    role: {
        resourceType: "string",
        roleName: "string",
        resourceId: "string",
    },
    userId: "string",
});
Copy
type: cockroach:UserRoleGrant
properties:
    role:
        resourceId: string
        resourceType: string
        roleName: string
    userId: string
Copy

UserRoleGrant Resource Properties

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

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The UserRoleGrant resource accepts the following input properties:

Role This property is required. Pulumiverse.Cockroach.Inputs.UserRoleGrantRole
UserId This property is required. string
ID of the user to grant these roles to.
Role This property is required. UserRoleGrantRoleArgs
UserId This property is required. string
ID of the user to grant these roles to.
role This property is required. UserRoleGrantRole
userId This property is required. String
ID of the user to grant these roles to.
role This property is required. UserRoleGrantRole
userId This property is required. string
ID of the user to grant these roles to.
role This property is required. UserRoleGrantRoleArgs
user_id This property is required. str
ID of the user to grant these roles to.
role This property is required. Property Map
userId This property is required. String
ID of the user to grant these roles to.

Outputs

All input properties are implicitly available as output properties. Additionally, the UserRoleGrant 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 string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing UserRoleGrant Resource

Get an existing UserRoleGrant 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?: UserRoleGrantState, opts?: CustomResourceOptions): UserRoleGrant
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        role: Optional[UserRoleGrantRoleArgs] = None,
        user_id: Optional[str] = None) -> UserRoleGrant
func GetUserRoleGrant(ctx *Context, name string, id IDInput, state *UserRoleGrantState, opts ...ResourceOption) (*UserRoleGrant, error)
public static UserRoleGrant Get(string name, Input<string> id, UserRoleGrantState? state, CustomResourceOptions? opts = null)
public static UserRoleGrant get(String name, Output<String> id, UserRoleGrantState state, CustomResourceOptions options)
resources:  _:    type: cockroach:UserRoleGrant    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
Role Pulumiverse.Cockroach.Inputs.UserRoleGrantRole
UserId string
ID of the user to grant these roles to.
Role UserRoleGrantRoleArgs
UserId string
ID of the user to grant these roles to.
role UserRoleGrantRole
userId String
ID of the user to grant these roles to.
role UserRoleGrantRole
userId string
ID of the user to grant these roles to.
role UserRoleGrantRoleArgs
user_id str
ID of the user to grant these roles to.
role Property Map
userId String
ID of the user to grant these roles to.

Supporting Types

UserRoleGrantRole
, UserRoleGrantRoleArgs

ResourceType This property is required. string
Type of resource. Allowed values are:

  • ORGANIZATION
  • CLUSTER
  • FOLDER
RoleName This property is required. string
Name of the role to grant. Allowed values are:

  • BILLING_COORDINATOR
  • ORG_ADMIN
  • ORG_MEMBER
  • CLUSTER_ADMIN
  • CLUSTER_OPERATOR_WRITER
  • CLUSTER_DEVELOPER
  • CLUSTER_CREATOR
  • FOLDER_ADMIN
  • FOLDER_MOVER
ResourceId string
ID of the resource. Required if the resource_type is 'FOLDER' or 'CLUSTER'. It should be omitted otherwise.
ResourceType This property is required. string
Type of resource. Allowed values are:

  • ORGANIZATION
  • CLUSTER
  • FOLDER
RoleName This property is required. string
Name of the role to grant. Allowed values are:

  • BILLING_COORDINATOR
  • ORG_ADMIN
  • ORG_MEMBER
  • CLUSTER_ADMIN
  • CLUSTER_OPERATOR_WRITER
  • CLUSTER_DEVELOPER
  • CLUSTER_CREATOR
  • FOLDER_ADMIN
  • FOLDER_MOVER
ResourceId string
ID of the resource. Required if the resource_type is 'FOLDER' or 'CLUSTER'. It should be omitted otherwise.
resourceType This property is required. String
Type of resource. Allowed values are:

  • ORGANIZATION
  • CLUSTER
  • FOLDER
roleName This property is required. String
Name of the role to grant. Allowed values are:

  • BILLING_COORDINATOR
  • ORG_ADMIN
  • ORG_MEMBER
  • CLUSTER_ADMIN
  • CLUSTER_OPERATOR_WRITER
  • CLUSTER_DEVELOPER
  • CLUSTER_CREATOR
  • FOLDER_ADMIN
  • FOLDER_MOVER
resourceId String
ID of the resource. Required if the resource_type is 'FOLDER' or 'CLUSTER'. It should be omitted otherwise.
resourceType This property is required. string
Type of resource. Allowed values are:

  • ORGANIZATION
  • CLUSTER
  • FOLDER
roleName This property is required. string
Name of the role to grant. Allowed values are:

  • BILLING_COORDINATOR
  • ORG_ADMIN
  • ORG_MEMBER
  • CLUSTER_ADMIN
  • CLUSTER_OPERATOR_WRITER
  • CLUSTER_DEVELOPER
  • CLUSTER_CREATOR
  • FOLDER_ADMIN
  • FOLDER_MOVER
resourceId string
ID of the resource. Required if the resource_type is 'FOLDER' or 'CLUSTER'. It should be omitted otherwise.
resource_type This property is required. str
Type of resource. Allowed values are:

  • ORGANIZATION
  • CLUSTER
  • FOLDER
role_name This property is required. str
Name of the role to grant. Allowed values are:

  • BILLING_COORDINATOR
  • ORG_ADMIN
  • ORG_MEMBER
  • CLUSTER_ADMIN
  • CLUSTER_OPERATOR_WRITER
  • CLUSTER_DEVELOPER
  • CLUSTER_CREATOR
  • FOLDER_ADMIN
  • FOLDER_MOVER
resource_id str
ID of the resource. Required if the resource_type is 'FOLDER' or 'CLUSTER'. It should be omitted otherwise.
resourceType This property is required. String
Type of resource. Allowed values are:

  • ORGANIZATION
  • CLUSTER
  • FOLDER
roleName This property is required. String
Name of the role to grant. Allowed values are:

  • BILLING_COORDINATOR
  • ORG_ADMIN
  • ORG_MEMBER
  • CLUSTER_ADMIN
  • CLUSTER_OPERATOR_WRITER
  • CLUSTER_DEVELOPER
  • CLUSTER_CREATOR
  • FOLDER_ADMIN
  • FOLDER_MOVER
resourceId String
ID of the resource. Required if the resource_type is 'FOLDER' or 'CLUSTER'. It should be omitted otherwise.

Import

Cluster and folder level role grants can be imported using:

<user_id>,<role_name>,<resource_type>,<resource_id>

$ pulumi import cockroach:index/userRoleGrant:UserRoleGrant admin_grant 1f69fdd2-600a-4cfc-a9ba-16995df0d77d,CLUSTER_ADMIN,CLUSTER,9b9d23fe-3848-40b2-a3c5-d8ccb1c4f831
Copy

Organization level grants can omit the resource_id

$ pulumi import cockroach:index/userRoleGrant:UserRoleGrant org_level_grant 1f69fdd2-600a-4cfc-a9ba-16995df0d77d,ORG_ADMIN,ORGANIZATION
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
cockroach pulumiverse/pulumi-cockroach
License
Apache-2.0
Notes
This Pulumi package is based on the cockroach Terraform Provider.