Class CustomDbRole
mongodbatlas..CustomDbRole provides a Custom DB Role resource. The customDBRoles resource lets you retrieve, create and modify the custom MongoDB roles in your cluster. Use custom MongoDB roles to specify custom sets of actions which cannot be described by the built-in Atlas database user privileges.
IMPORTANT Custom roles cannot use actions unavailable to any cluster version in your project. Custom roles are defined at the project level, and must be compatible with each MongoDB version used by your project’s clusters. If you have a cluster in your project with MongoDB 3.4, you cannot create a custom role that uses actions introduced in MongoDB 3.6, such as useUUID.
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",
},
},
},
new Mongodbatlas.Inputs.CustomDbRoleActionArgs
{
Action = "REMOVE",
Resources =
{
new Mongodbatlas.Inputs.CustomDbRoleActionResourceArgs
{
CollectionName = "",
DatabaseName = "anyDatabase",
},
},
},
},
ProjectId = "<PROJECT-ID>",
RoleName = "myCustomRole",
});
}
}
Example Usage with inherited roles
using Pulumi;
using Mongodbatlas = Pulumi.Mongodbatlas;
class MyStack : Stack
{
public MyStack()
{
var inheritedRoleOne = new Mongodbatlas.CustomDbRole("inheritedRoleOne", new Mongodbatlas.CustomDbRoleArgs
{
Actions =
{
new Mongodbatlas.Inputs.CustomDbRoleActionArgs
{
Action = "INSERT",
Resources =
{
new Mongodbatlas.Inputs.CustomDbRoleActionResourceArgs
{
CollectionName = "",
DatabaseName = "anyDatabase",
},
},
},
},
ProjectId = "<PROJECT-ID>",
RoleName = "insertRole",
});
var inheritedRoleTwo = new Mongodbatlas.CustomDbRole("inheritedRoleTwo", new Mongodbatlas.CustomDbRoleArgs
{
Actions =
{
new Mongodbatlas.Inputs.CustomDbRoleActionArgs
{
Action = "SERVER_STATUS",
Resources =
{
new Mongodbatlas.Inputs.CustomDbRoleActionResourceArgs
{
Cluster = true,
},
},
},
},
ProjectId = inheritedRoleOne.ProjectId,
RoleName = "statusServerRole",
});
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 = "REMOVE",
Resources =
{
new Mongodbatlas.Inputs.CustomDbRoleActionResourceArgs
{
CollectionName = "",
DatabaseName = "anyDatabase",
},
},
},
},
InheritedRoles =
{
new Mongodbatlas.Inputs.CustomDbRoleInheritedRoleArgs
{
DatabaseName = "admin",
RoleName = inheritedRoleOne.RoleName,
},
new Mongodbatlas.Inputs.CustomDbRoleInheritedRoleArgs
{
DatabaseName = "admin",
RoleName = inheritedRoleTwo.RoleName,
},
},
ProjectId = inheritedRoleOne.ProjectId,
RoleName = "myCustomRole",
});
}
}
Inherited Members
Namespace: Pulumi.Mongodbatlas
Assembly: Pulumi.Mongodbatlas.dll
Syntax
public class CustomDbRole : CustomResource
Constructors
View SourceCustomDbRole(String, CustomDbRoleArgs, CustomResourceOptions)
Create a CustomDbRole resource with the given unique name, arguments, and options.
Declaration
public CustomDbRole(string name, CustomDbRoleArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| CustomDbRoleArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceActions
Declaration
public Output<ImmutableArray<CustomDbRoleAction>> Actions { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<CustomDbRoleAction>> |
InheritedRoles
Declaration
public Output<ImmutableArray<CustomDbRoleInheritedRole>> InheritedRoles { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<CustomDbRoleInheritedRole>> |
ProjectId
The unique ID for the project to create the database user.
Declaration
public Output<string> ProjectId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
RoleName
Name of the inherited role. This can either be another custom role or a built-in role.
Declaration
public Output<string> RoleName { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(String, Input<String>, CustomDbRoleState, CustomResourceOptions)
Get an existing CustomDbRole resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static CustomDbRole Get(string name, Input<string> id, CustomDbRoleState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| CustomDbRoleState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| CustomDbRole |