MongoDB Atlas

Pulumi Official
Package maintained by Pulumi
v3.5.0 published on Wednesday, Jul 20, 2022 by Pulumi

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
        {
            Username = "test-acc-username",
            Password = "test-acc-password",
            ProjectId = "<PROJECT-ID>",
            DatabaseName = "admin",
            Roles = 
            {
                new Mongodbatlas.Inputs.DatabaseUserRoleArgs
                {
                    RoleName = "readWrite",
                    DatabaseName = "admin",
                },
                new Mongodbatlas.Inputs.DatabaseUserRoleArgs
                {
                    RoleName = "atlasAdmin",
                    DatabaseName = "admin",
                },
            },
        });
        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/v3/go/mongodbatlas"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := mongodbatlas.NewDatabaseUser(ctx, "testDatabaseUser", &mongodbatlas.DatabaseUserArgs{
			Username:     pulumi.String("test-acc-username"),
			Password:     pulumi.String("test-acc-password"),
			ProjectId:    pulumi.String("<PROJECT-ID>"),
			DatabaseName: pulumi.String("admin"),
			Roles: DatabaseUserRoleArray{
				&DatabaseUserRoleArgs{
					RoleName:     pulumi.String("readWrite"),
					DatabaseName: pulumi.String("admin"),
				},
				&DatabaseUserRoleArgs{
					RoleName:     pulumi.String("atlasAdmin"),
					DatabaseName: pulumi.String("admin"),
				},
			},
		})
		if err != nil {
			return err
		}
		_, err = mongodbatlas.LookupCustomDbRoles(ctx, &GetCustomDbRolesArgs{
			ProjectId: mongodbatlas_custom_db_role.Test.Project_id,
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}

Coming soon!

import pulumi
import pulumi_mongodbatlas as mongodbatlas

test_database_user = mongodbatlas.DatabaseUser("testDatabaseUser",
    username="test-acc-username",
    password="test-acc-password",
    project_id="<PROJECT-ID>",
    database_name="admin",
    roles=[
        mongodbatlas.DatabaseUserRoleArgs(
            role_name="readWrite",
            database_name="admin",
        ),
        mongodbatlas.DatabaseUserRoleArgs(
            role_name="atlasAdmin",
            database_name="admin",
        ),
    ])
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("testDatabaseUser", {
    username: "test-acc-username",
    password: "test-acc-password",
    projectId: "<PROJECT-ID>",
    databaseName: "admin",
    roles: [
        {
            roleName: "readWrite",
            databaseName: "admin",
        },
        {
            roleName: "atlasAdmin",
            databaseName: "admin",
        },
    ],
});
const testCustomDbRoles = mongodbatlas.getCustomDbRoles({
    projectId: mongodbatlas_custom_db_role.test.project_id,
});

Coming soon!

Using getCustomDbRoles

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getCustomDbRoles(args: GetCustomDbRolesArgs, opts?: InvokeOptions): Promise<GetCustomDbRolesResult>
function getCustomDbRolesOutput(args: GetCustomDbRolesOutputArgs, opts?: InvokeOptions): Output<GetCustomDbRolesResult>
def get_custom_db_roles(project_id: Optional[str] = None,
                        opts: Optional[InvokeOptions] = None) -> GetCustomDbRolesResult
def get_custom_db_roles_output(project_id: Optional[pulumi.Input[str]] = None,
                        opts: Optional[InvokeOptions] = None) -> Output[GetCustomDbRolesResult]
func LookupCustomDbRoles(ctx *Context, args *LookupCustomDbRolesArgs, opts ...InvokeOption) (*LookupCustomDbRolesResult, error)
func LookupCustomDbRolesOutput(ctx *Context, args *LookupCustomDbRolesOutputArgs, opts ...InvokeOption) LookupCustomDbRolesResultOutput

> Note: This function is named LookupCustomDbRoles in the Go SDK.

public static class GetCustomDbRoles 
{
    public static Task<GetCustomDbRolesResult> InvokeAsync(GetCustomDbRolesArgs args, InvokeOptions? opts = null)
    public static Output<GetCustomDbRolesResult> Invoke(GetCustomDbRolesInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetCustomDbRolesResult> getCustomDbRoles(GetCustomDbRolesArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: mongodbatlas:index/getCustomDbRoles:getCustomDbRoles
  Arguments:
    # Arguments dictionary

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.

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.

projectId String

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 []GetCustomDbRolesResult

A list where each represents a custom db roles.

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

id String

The provider-assigned unique ID for this managed resource.

projectId String
results List<Property Map>

A list where each represents a custom db roles.

Supporting Types

GetCustomDbRolesResult

GetCustomDbRolesResultAction

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

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

resources List<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[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 List<Property Map>

(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

cluster Boolean
collectionName String
databaseName String
cluster boolean
collectionName string
databaseName string
cluster Boolean
collectionName String
databaseName String

GetCustomDbRolesResultInheritedRole

DatabaseName string
RoleName string
DatabaseName string
RoleName string
databaseName String
roleName String
databaseName string
roleName string
databaseName String
roleName String

Package Details

Repository
https://github.com/pulumi/pulumi-mongodbatlas
License
Apache-2.0
Notes

This Pulumi package is based on the mongodbatlas Terraform Provider.