Get started with Pulumi in a free one hour introductory workshop. Register Now

GetCustomDbRole

mongodbatlas.CustomDbRole describe a Custom DB Role. This represents a custom db role.

NOTE: Groups and projects are synonymous terms. You may find group_id in the official documentation.

Example Usage

using Pulumi;
using Mongodbatlas = Pulumi.Mongodbatlas;

class MyStack : Stack
{
    public MyStack()
    {
        var testRole = new Mongodbatlas.CustomDbRole("testRole", new Mongodbatlas.CustomDbRoleArgs
        {
            Actions = 
            {
                new Mongodbatlas.Inputs.CustomDbRoleActionArgs
                {
                    Action = "UPDATE",
                    Resources = 
                    {
                        new Mongodbatlas.Inputs.CustomDbRoleActionResourceArgs
                        {
                            CollectionName = "",
                            DatabaseName = "anyDatabase",
                        },
                    },
                },
                new Mongodbatlas.Inputs.CustomDbRoleActionArgs
                {
                    Action = "INSERT",
                    Resources = 
                    {
                        new Mongodbatlas.Inputs.CustomDbRoleActionResourceArgs
                        {
                            CollectionName = "",
                            DatabaseName = "anyDatabase",
                        },
                    },
                },
            },
            ProjectId = "<PROJECT-ID>",
            RoleName = "myCustomRole",
        });
        var test = Output.Tuple(testRole.ProjectId, testRole.RoleName).Apply(values =>
        {
            var projectId = values.Item1;
            var roleName = values.Item2;
            return Mongodbatlas.GetCustomDbRole.InvokeAsync(new Mongodbatlas.GetCustomDbRoleArgs
            {
                ProjectId = projectId,
                RoleName = roleName,
            });
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-mongodbatlas/sdk/go/mongodbatlas"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        testRole, err := mongodbatlas.NewCustomDbRole(ctx, "testRole", &mongodbatlas.CustomDbRoleArgs{
            Actions: mongodbatlas.CustomDbRoleActionArray{
                &mongodbatlas.CustomDbRoleActionArgs{
                    Action: pulumi.String("UPDATE"),
                    Resources: mongodbatlas.CustomDbRoleActionResourceArray{
                        &mongodbatlas.CustomDbRoleActionResourceArgs{
                            CollectionName: pulumi.String(""),
                            DatabaseName:   pulumi.String("anyDatabase"),
                        },
                    },
                },
                &mongodbatlas.CustomDbRoleActionArgs{
                    Action: pulumi.String("INSERT"),
                    Resources: mongodbatlas.CustomDbRoleActionResourceArray{
                        &mongodbatlas.CustomDbRoleActionResourceArgs{
                            CollectionName: pulumi.String(""),
                            DatabaseName:   pulumi.String("anyDatabase"),
                        },
                    },
                },
            },
            ProjectId: pulumi.String("<PROJECT-ID>"),
            RoleName:  pulumi.String("myCustomRole"),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_mongodbatlas as mongodbatlas

test_role = mongodbatlas.CustomDbRole("testRole",
    actions=[
        mongodbatlas.CustomDbRoleActionArgs(
            action="UPDATE",
            resources=[mongodbatlas.CustomDbRoleActionResourceArgs(
                collection_name="",
                database_name="anyDatabase",
            )],
        ),
        mongodbatlas.CustomDbRoleActionArgs(
            action="INSERT",
            resources=[mongodbatlas.CustomDbRoleActionResourceArgs(
                collection_name="",
                database_name="anyDatabase",
            )],
        ),
    ],
    project_id="<PROJECT-ID>",
    role_name="myCustomRole")
test = pulumi.Output.all(test_role.project_id, test_role.role_name).apply(lambda project_id, role_name: mongodbatlas.get_custom_db_role(project_id=project_id,
    role_name=role_name))
import * as pulumi from "@pulumi/pulumi";
import * as mongodbatlas from "@pulumi/mongodbatlas";

const testRole = new mongodbatlas.CustomDbRole("test_role", {
    actions: [
        {
            action: "UPDATE",
            resources: [{
                collectionName: "",
                databaseName: "anyDatabase",
            }],
        },
        {
            action: "INSERT",
            resources: [{
                collectionName: "",
                databaseName: "anyDatabase",
            }],
        },
    ],
    projectId: "<PROJECT-ID>",
    roleName: "myCustomRole",
});
const test = pulumi.all([testRole.projectId, testRole.roleName]).apply(([projectId, roleName]) => mongodbatlas.getCustomDbRole({
    projectId: projectId,
    roleName: roleName,
}, { async: true }));

Using GetCustomDbRole

function getCustomDbRole(args: GetCustomDbRoleArgs, opts?: InvokeOptions): Promise<GetCustomDbRoleResult>
def get_custom_db_role(inherited_roles: Optional[Sequence[GetCustomDbRoleInheritedRoleArgs]] = None, project_id: Optional[str] = None, role_name: Optional[str] = None, opts: Optional[InvokeOptions] = None) -> GetCustomDbRoleResult
func LookupCustomDbRole(ctx *Context, args *LookupCustomDbRoleArgs, opts ...InvokeOption) (*LookupCustomDbRoleResult, error)

Note: This function is named LookupCustomDbRole in the Go SDK.

public static class GetCustomDbRole {
    public static Task<GetCustomDbRoleResult> InvokeAsync(GetCustomDbRoleArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

ProjectId string

The unique ID for the project to create the database user.

RoleName string

Name of the custom role.

InheritedRoles List<GetCustomDbRoleInheritedRoleArgs>
ProjectId string

The unique ID for the project to create the database user.

RoleName string

Name of the custom role.

InheritedRoles []GetCustomDbRoleInheritedRole
projectId string

The unique ID for the project to create the database user.

roleName string

Name of the custom role.

inheritedRoles GetCustomDbRoleInheritedRole[]
project_id str

The unique ID for the project to create the database user.

role_name str

Name of the custom role.

inherited_roles Sequence[GetCustomDbRoleInheritedRoleArgs]

GetCustomDbRole Result

The following output properties are available:

Actions List<GetCustomDbRoleAction>
Id string

The provider-assigned unique ID for this managed resource.

ProjectId string
RoleName string
InheritedRoles List<GetCustomDbRoleInheritedRole>
Actions []GetCustomDbRoleAction
Id string

The provider-assigned unique ID for this managed resource.

ProjectId string
RoleName string
InheritedRoles []GetCustomDbRoleInheritedRole
actions GetCustomDbRoleAction[]
id string

The provider-assigned unique ID for this managed resource.

projectId string
roleName string
inheritedRoles GetCustomDbRoleInheritedRole[]
actions Sequence[GetCustomDbRoleAction]
id str

The provider-assigned unique ID for this managed resource.

project_id str
role_name str
inherited_roles Sequence[GetCustomDbRoleInheritedRole]

Supporting Types

GetCustomDbRoleAction

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

Action string

(Required) Name of the privilege action. For a complete list of actions available in the Atlas API, see Custom Role Actions.

Resources List<GetCustomDbRoleActionResourceArgs>

(Required) Contains information on where the action is granted. Each object in the array either indicates a database and collection on which the action is granted, or indicates that the action is granted on the cluster resource.

Action string

(Required) Name of the privilege action. For a complete list of actions available in the Atlas API, see Custom Role Actions.

Resources []GetCustomDbRoleActionResource

(Required) Contains information on where the action is granted. Each object in the array either indicates a database and collection on which the action is granted, or indicates that the action is granted on the cluster resource.

action string

(Required) Name of the privilege action. For a complete list of actions available in the Atlas API, see Custom Role Actions.

resources GetCustomDbRoleActionResource[]

(Required) Contains information on where the action is granted. Each object in the array either indicates a database and collection on which the action is granted, or indicates that the action is granted on the cluster resource.

action str

(Required) Name of the privilege action. For a complete list of actions available in the Atlas API, see Custom Role Actions.

resources Sequence[GetCustomDbRoleActionResourceArgs]

(Required) Contains information on where the action is granted. Each object in the array either indicates a database and collection on which the action is granted, or indicates that the action is granted on the cluster resource.

GetCustomDbRoleActionResource

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

Cluster bool
CollectionName string
DatabaseName string
Cluster bool
CollectionName string
DatabaseName string
cluster boolean
collectionName string
databaseName string
cluster bool
collection_name str
database_name str

GetCustomDbRoleInheritedRole

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

DatabaseName string
RoleName string

Name of the custom role.

DatabaseName string
RoleName string

Name of the custom role.

databaseName string
roleName string

Name of the custom role.

database_name str
role_name str

Name of the custom role.

Package Details

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