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

GetCustomDbRoles

mongodbatlas.getCustomDbRoles describe all Custom DB Roles. This represents a custom db roles.

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

Example Usage

using Pulumi;
using Mongodbatlas = Pulumi.Mongodbatlas;

class MyStack : Stack
{
    public MyStack()
    {
        var testDatabaseUser = new Mongodbatlas.DatabaseUser("testDatabaseUser", new Mongodbatlas.DatabaseUserArgs
        {
            DatabaseName = "admin",
            Password = "test-acc-password",
            ProjectId = "<PROJECT-ID>",
            Roles = 
            {
                new Mongodbatlas.Inputs.DatabaseUserRoleArgs
                {
                    DatabaseName = "admin",
                    RoleName = "readWrite",
                },
                new Mongodbatlas.Inputs.DatabaseUserRoleArgs
                {
                    DatabaseName = "admin",
                    RoleName = "atlasAdmin",
                },
            },
            Username = "test-acc-username",
        });
        var testCustomDbRoles = Output.Create(Mongodbatlas.GetCustomDbRoles.InvokeAsync(new Mongodbatlas.GetCustomDbRolesArgs
        {
            ProjectId = mongodbatlas_custom_db_role.Test.Project_id,
        }));
    }

}
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 {
        _, err := mongodbatlas.NewDatabaseUser(ctx, "testDatabaseUser", &mongodbatlas.DatabaseUserArgs{
            DatabaseName: pulumi.String("admin"),
            Password:     pulumi.String("test-acc-password"),
            ProjectId:    pulumi.String("<PROJECT-ID>"),
            Roles: mongodbatlas.DatabaseUserRoleArray{
                &mongodbatlas.DatabaseUserRoleArgs{
                    DatabaseName: pulumi.String("admin"),
                    RoleName:     pulumi.String("readWrite"),
                },
                &mongodbatlas.DatabaseUserRoleArgs{
                    DatabaseName: pulumi.String("admin"),
                    RoleName:     pulumi.String("atlasAdmin"),
                },
            },
            Username: pulumi.String("test-acc-username"),
        })
        if err != nil {
            return err
        }
        _, err = mongodbatlas.GetCustomDbRoles(ctx, &mongodbatlas.GetCustomDbRolesArgs{
            ProjectId: mongodbatlas_custom_db_role.Test.Project_id,
        }, nil)
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_mongodbatlas as mongodbatlas

test_database_user = mongodbatlas.DatabaseUser("testDatabaseUser",
    database_name="admin",
    password="test-acc-password",
    project_id="<PROJECT-ID>",
    roles=[
        mongodbatlas.DatabaseUserRoleArgs(
            database_name="admin",
            role_name="readWrite",
        ),
        mongodbatlas.DatabaseUserRoleArgs(
            database_name="admin",
            role_name="atlasAdmin",
        ),
    ],
    username="test-acc-username")
test_custom_db_roles = mongodbatlas.get_custom_db_roles(project_id=mongodbatlas_custom_db_role["test"]["project_id"])
import * as pulumi from "@pulumi/pulumi";
import * as mongodbatlas from "@pulumi/mongodbatlas";

const testDatabaseUser = new mongodbatlas.DatabaseUser("test", {
    databaseName: "admin",
    password: "test-acc-password",
    projectId: "<PROJECT-ID>",
    roles: [
        {
            databaseName: "admin",
            roleName: "readWrite",
        },
        {
            databaseName: "admin",
            roleName: "atlasAdmin",
        },
    ],
    username: "test-acc-username",
});
const testCustomDbRoles = mongodbatlas_custom_db_role_test.projectId.apply(projectId => mongodbatlas.getCustomDbRoles({
    projectId: projectId,
}, { async: true }));

Using GetCustomDbRoles

function getCustomDbRoles(args: GetCustomDbRolesArgs, opts?: InvokeOptions): Promise<GetCustomDbRolesResult>
def get_custom_db_roles(project_id: Optional[str] = None, opts: Optional[InvokeOptions] = None) -> GetCustomDbRolesResult
func GetCustomDbRoles(ctx *Context, args *GetCustomDbRolesArgs, opts ...InvokeOption) (*GetCustomDbRolesResult, error)
public static class GetCustomDbRoles {
    public static Task<GetCustomDbRolesResult> InvokeAsync(GetCustomDbRolesArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

ProjectId string

The unique ID for the project to get all custom db roles.

ProjectId string

The unique ID for the project to get all custom db roles.

projectId string

The unique ID for the project to get all custom db roles.

project_id str

The unique ID for the project to get all custom db roles.

GetCustomDbRoles Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

ProjectId string
Results List<GetCustomDbRolesResult>

A list where each represents a custom db roles.

Id string

The provider-assigned unique ID for this managed resource.

ProjectId string
Results []GetCustomDbRolesResultType

A list where each represents a custom db roles.

id string

The provider-assigned unique ID for this managed resource.

projectId string
results GetCustomDbRolesResult[]

A list where each represents a custom db roles.

id str

The provider-assigned unique ID for this managed resource.

project_id str
results Sequence[GetCustomDbRolesResult]

A list where each represents a custom db roles.

Supporting Types

GetCustomDbRolesResult

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

Actions List<GetCustomDbRolesResultActionArgs>
InheritedRoles List<GetCustomDbRolesResultInheritedRoleArgs>
RoleName string
Actions []GetCustomDbRolesResultAction
InheritedRoles []GetCustomDbRolesResultInheritedRole
RoleName string
actions GetCustomDbRolesResultAction[]
inheritedRoles GetCustomDbRolesResultInheritedRole[]
roleName string
actions Sequence[GetCustomDbRolesResultActionArgs]
inherited_roles Sequence[GetCustomDbRolesResultInheritedRoleArgs]
role_name str

GetCustomDbRolesResultAction

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<GetCustomDbRolesResultActionResourceArgs>

(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 []GetCustomDbRolesResultActionResource

(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 GetCustomDbRolesResultActionResource[]

(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[GetCustomDbRolesResultActionResourceArgs]

(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.

GetCustomDbRolesResultActionResource

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

GetCustomDbRolesResultInheritedRole

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

DatabaseName string
RoleName string
DatabaseName string
RoleName string
databaseName string
roleName string
database_name str
role_name str

Package Details

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