MongoDB Atlas v3.20.4 published on Wednesday, Oct 30, 2024 by Pulumi
mongodbatlas.getCustomDbRole
Explore with Pulumi AI
# Data Source: mongodbatlas.CustomDbRole
mongodbatlas.CustomDbRole
describes 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
import * as pulumi from "@pulumi/pulumi";
import * as mongodbatlas from "@pulumi/mongodbatlas";
const testRole = new mongodbatlas.CustomDbRole("test_role", {
projectId: "<PROJECT-ID>",
roleName: "myCustomRole",
actions: [
{
action: "UPDATE",
resources: [{
collectionName: "",
databaseName: "anyDatabase",
}],
},
{
action: "INSERT",
resources: [{
collectionName: "",
databaseName: "anyDatabase",
}],
},
],
});
const test = mongodbatlas.getCustomDbRoleOutput({
projectId: testRole.projectId,
roleName: testRole.roleName,
});
import pulumi
import pulumi_mongodbatlas as mongodbatlas
test_role = mongodbatlas.CustomDbRole("test_role",
project_id="<PROJECT-ID>",
role_name="myCustomRole",
actions=[
{
"action": "UPDATE",
"resources": [{
"collection_name": "",
"database_name": "anyDatabase",
}],
},
{
"action": "INSERT",
"resources": [{
"collection_name": "",
"database_name": "anyDatabase",
}],
},
])
test = mongodbatlas.get_custom_db_role_output(project_id=test_role.project_id,
role_name=test_role.role_name)
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 {
testRole, err := mongodbatlas.NewCustomDbRole(ctx, "test_role", &mongodbatlas.CustomDbRoleArgs{
ProjectId: pulumi.String("<PROJECT-ID>"),
RoleName: pulumi.String("myCustomRole"),
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"),
},
},
},
},
})
if err != nil {
return err
}
_ = mongodbatlas.LookupCustomDbRoleOutput(ctx, mongodbatlas.GetCustomDbRoleOutputArgs{
ProjectId: testRole.ProjectId,
RoleName: testRole.RoleName,
}, nil)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Mongodbatlas = Pulumi.Mongodbatlas;
return await Deployment.RunAsync(() =>
{
var testRole = new Mongodbatlas.CustomDbRole("test_role", new()
{
ProjectId = "<PROJECT-ID>",
RoleName = "myCustomRole",
Actions = new[]
{
new Mongodbatlas.Inputs.CustomDbRoleActionArgs
{
Action = "UPDATE",
Resources = new[]
{
new Mongodbatlas.Inputs.CustomDbRoleActionResourceArgs
{
CollectionName = "",
DatabaseName = "anyDatabase",
},
},
},
new Mongodbatlas.Inputs.CustomDbRoleActionArgs
{
Action = "INSERT",
Resources = new[]
{
new Mongodbatlas.Inputs.CustomDbRoleActionResourceArgs
{
CollectionName = "",
DatabaseName = "anyDatabase",
},
},
},
},
});
var test = Mongodbatlas.GetCustomDbRole.Invoke(new()
{
ProjectId = testRole.ProjectId,
RoleName = testRole.RoleName,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.mongodbatlas.CustomDbRole;
import com.pulumi.mongodbatlas.CustomDbRoleArgs;
import com.pulumi.mongodbatlas.inputs.CustomDbRoleActionArgs;
import com.pulumi.mongodbatlas.MongodbatlasFunctions;
import com.pulumi.mongodbatlas.inputs.GetCustomDbRoleArgs;
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) {
var testRole = new CustomDbRole("testRole", CustomDbRoleArgs.builder()
.projectId("<PROJECT-ID>")
.roleName("myCustomRole")
.actions(
CustomDbRoleActionArgs.builder()
.action("UPDATE")
.resources(CustomDbRoleActionResourceArgs.builder()
.collectionName("")
.databaseName("anyDatabase")
.build())
.build(),
CustomDbRoleActionArgs.builder()
.action("INSERT")
.resources(CustomDbRoleActionResourceArgs.builder()
.collectionName("")
.databaseName("anyDatabase")
.build())
.build())
.build());
final var test = MongodbatlasFunctions.getCustomDbRole(GetCustomDbRoleArgs.builder()
.projectId(testRole.projectId())
.roleName(testRole.roleName())
.build());
}
}
resources:
testRole:
type: mongodbatlas:CustomDbRole
name: test_role
properties:
projectId: <PROJECT-ID>
roleName: myCustomRole
actions:
- action: UPDATE
resources:
- collectionName:
databaseName: anyDatabase
- action: INSERT
resources:
- collectionName:
databaseName: anyDatabase
variables:
test:
fn::invoke:
Function: mongodbatlas:getCustomDbRole
Arguments:
projectId: ${testRole.projectId}
roleName: ${testRole.roleName}
Using getCustomDbRole
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 getCustomDbRole(args: GetCustomDbRoleArgs, opts?: InvokeOptions): Promise<GetCustomDbRoleResult>
function getCustomDbRoleOutput(args: GetCustomDbRoleOutputArgs, opts?: InvokeOptions): Output<GetCustomDbRoleResult>
def get_custom_db_role(inherited_roles: Optional[Sequence[GetCustomDbRoleInheritedRole]] = None,
project_id: Optional[str] = None,
role_name: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetCustomDbRoleResult
def get_custom_db_role_output(inherited_roles: Optional[pulumi.Input[Sequence[pulumi.Input[GetCustomDbRoleInheritedRoleArgs]]]] = None,
project_id: Optional[pulumi.Input[str]] = None,
role_name: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetCustomDbRoleResult]
func LookupCustomDbRole(ctx *Context, args *LookupCustomDbRoleArgs, opts ...InvokeOption) (*LookupCustomDbRoleResult, error)
func LookupCustomDbRoleOutput(ctx *Context, args *LookupCustomDbRoleOutputArgs, opts ...InvokeOption) LookupCustomDbRoleResultOutput
> Note: This function is named LookupCustomDbRole
in the Go SDK.
public static class GetCustomDbRole
{
public static Task<GetCustomDbRoleResult> InvokeAsync(GetCustomDbRoleArgs args, InvokeOptions? opts = null)
public static Output<GetCustomDbRoleResult> Invoke(GetCustomDbRoleInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetCustomDbRoleResult> getCustomDbRole(GetCustomDbRoleArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: mongodbatlas:index/getCustomDbRole:getCustomDbRole
arguments:
# arguments dictionary
The following arguments are supported:
- Project
Id string - The unique ID for the project to create the database user.
- Role
Name string - Name of the custom role.
- Inherited
Roles List<GetCustom Db Role Inherited Role>
- Project
Id string - The unique ID for the project to create the database user.
- Role
Name string - Name of the custom role.
- Inherited
Roles []GetCustom Db Role Inherited Role
- project
Id String - The unique ID for the project to create the database user.
- role
Name String - Name of the custom role.
- inherited
Roles List<GetCustom Db Role Inherited Role>
- project
Id string - The unique ID for the project to create the database user.
- role
Name string - Name of the custom role.
- inherited
Roles GetCustom Db Role Inherited Role[]
- 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[GetCustom Db Role Inherited Role]
- project
Id String - The unique ID for the project to create the database user.
- role
Name String - Name of the custom role.
- inherited
Roles List<Property Map>
getCustomDbRole Result
The following output properties are available:
- Actions
List<Get
Custom Db Role Action> - Id string
- The provider-assigned unique ID for this managed resource.
- Project
Id string - Role
Name string - (Required) Name of the inherited role. This can either be another custom role or a built-in role.
- Inherited
Roles List<GetCustom Db Role Inherited Role>
- Actions
[]Get
Custom Db Role Action - Id string
- The provider-assigned unique ID for this managed resource.
- Project
Id string - Role
Name string - (Required) Name of the inherited role. This can either be another custom role or a built-in role.
- Inherited
Roles []GetCustom Db Role Inherited Role
- actions
List<Get
Custom Db Role Action> - id String
- The provider-assigned unique ID for this managed resource.
- project
Id String - role
Name String - (Required) Name of the inherited role. This can either be another custom role or a built-in role.
- inherited
Roles List<GetCustom Db Role Inherited Role>
- actions
Get
Custom Db Role Action[] - id string
- The provider-assigned unique ID for this managed resource.
- project
Id string - role
Name string - (Required) Name of the inherited role. This can either be another custom role or a built-in role.
- inherited
Roles GetCustom Db Role Inherited Role[]
- actions
Sequence[Get
Custom Db Role Action] - id str
- The provider-assigned unique ID for this managed resource.
- project_
id str - role_
name str - (Required) Name of the inherited role. This can either be another custom role or a built-in role.
- inherited_
roles Sequence[GetCustom Db Role Inherited Role]
- actions List<Property Map>
- id String
- The provider-assigned unique ID for this managed resource.
- project
Id String - role
Name String - (Required) Name of the inherited role. This can either be another custom role or a built-in role.
- inherited
Roles List<Property Map>
Supporting Types
GetCustomDbRoleAction
- 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<Get
Custom Db Role Action Resource> - (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
[]Get
Custom Db Role Action Resource - (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<Get
Custom Db Role Action Resource> - (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
Get
Custom Db Role Action Resource[] - (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[Get
Custom Db Role Action Resource] - (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.
GetCustomDbRoleActionResource
- Cluster bool
- Collection
Name string - Database
Name string - (Required) Database on which the inherited role is granted.
- Cluster bool
- Collection
Name string - Database
Name string - (Required) Database on which the inherited role is granted.
- cluster Boolean
- collection
Name String - database
Name String - (Required) Database on which the inherited role is granted.
- cluster boolean
- collection
Name string - database
Name string - (Required) Database on which the inherited role is granted.
- cluster bool
- collection_
name str - database_
name str - (Required) Database on which the inherited role is granted.
- cluster Boolean
- collection
Name String - database
Name String - (Required) Database on which the inherited role is granted.
GetCustomDbRoleInheritedRole
- Database
Name string - (Required) Database on which the inherited role is granted.
- Role
Name string - Name of the custom role.
- Database
Name string - (Required) Database on which the inherited role is granted.
- Role
Name string - Name of the custom role.
- database
Name String - (Required) Database on which the inherited role is granted.
- role
Name String - Name of the custom role.
- database
Name string - (Required) Database on which the inherited role is granted.
- role
Name string - Name of the custom role.
- database_
name str - (Required) Database on which the inherited role is granted.
- role_
name str - Name of the custom role.
- database
Name String - (Required) Database on which the inherited role is granted.
- role
Name String - Name of the custom role.
Package Details
- Repository
- MongoDB Atlas pulumi/pulumi-mongodbatlas
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
mongodbatlas
Terraform Provider.