GetDatabaseUsers
mongodbatlas..getDatabaseUsers describe all Database Users. This represents a database user which will be applied to all clusters within the project.
Each user has a set of roles that provide access to the project’s databases. User’s roles apply to all the clusters in the project: if two clusters have a products database and a user has a role granting read access on the products database, the user has that access on both clusters.
NOTE: Groups and projects are synonymous terms. You may find
groupIdin 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>",
AuthDatabaseName = "admin",
Roles =
{
new Mongodbatlas.Inputs.DatabaseUserRoleArgs
{
RoleName = "readWrite",
DatabaseName = "admin",
},
new Mongodbatlas.Inputs.DatabaseUserRoleArgs
{
RoleName = "atlasAdmin",
DatabaseName = "admin",
},
},
Labels =
{
new Mongodbatlas.Inputs.DatabaseUserLabelArgs
{
Key = "key 1",
Value = "value 1",
},
new Mongodbatlas.Inputs.DatabaseUserLabelArgs
{
Key = "key 2",
Value = "value 2",
},
},
});
var testDatabaseUsers = testDatabaseUser.ProjectId.Apply(projectId => Mongodbatlas.GetDatabaseUsers.InvokeAsync(new Mongodbatlas.GetDatabaseUsersArgs
{
ProjectId = projectId,
}));
}
}
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>",
auth_database_name="admin",
roles=[
{
"role_name": "readWrite",
"database_name": "admin",
},
{
"role_name": "atlasAdmin",
"database_name": "admin",
},
],
labels=[
{
"key": "key 1",
"value": "value 1",
},
{
"key": "key 2",
"value": "value 2",
},
])
test_database_users = test_database_user.project_id.apply(lambda project_id: mongodbatlas.get_database_users(project_id=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>",
authDatabaseName: "admin",
roles: [
{
roleName: "readWrite",
databaseName: "admin",
},
{
roleName: "atlasAdmin",
databaseName: "admin",
},
],
labels: [
{
key: "key 1",
value: "value 1",
},
{
key: "key 2",
value: "value 2",
},
],
});
const testDatabaseUsers = testDatabaseUser.projectId.apply(projectId => mongodbatlas.getDatabaseUsers({
projectId: projectId,
}));Using GetDatabaseUsers
function getDatabaseUsers(args: GetDatabaseUsersArgs, opts?: InvokeOptions): Promise<GetDatabaseUsersResult>function get_database_users(project_id=None, opts=None)func GetDatabaseUsers(ctx *Context, args *GetDatabaseUsersArgs, opts ...InvokeOption) (*GetDatabaseUsersResult, error)public static class GetDatabaseUsers {
public static Task<GetDatabaseUsersResult> InvokeAsync(GetDatabaseUsersArgs args, InvokeOptions? opts = null)
}The following arguments are supported:
- project_
id str The unique ID for the project to get all database users.
GetDatabaseUsers Result
The following output properties are available:
- id str
The provider-assigned unique ID for this managed resource.
- project_
id str ID of the Atlas project the user belongs to.
- results
List[Get
Database Users Result] A list where each represents a Database user.
Supporting Types
GetDatabaseUsersResult
See the output API doc for this type.
See the output API doc for this type.
See the output API doc for this type.
- Auth
Database stringName The user’s authentication database. A user must provide both a username and authentication database to log into MongoDB. In Atlas deployments of MongoDB, the authentication database is always the admin database.
- Labels
List<Get
Database Users Result Label Args> - Project
Id string The unique ID for the project to get all database users.
- Roles
List<Get
Database Users Result Role Args> List of user’s roles and the databases / collections on which the roles apply. A role allows the user to perform particular actions on the specified database. A role on the admin database can include privileges that apply to the other databases as well. See Roles below for more details.
- Username string
Username for authenticating to MongoDB.
- X509Type string
X.509 method by which the provided username is authenticated.
- Auth
Database stringName The user’s authentication database. A user must provide both a username and authentication database to log into MongoDB. In Atlas deployments of MongoDB, the authentication database is always the admin database.
- Labels
[]Get
Database Users Result Label - Project
Id string The unique ID for the project to get all database users.
- Roles
[]Get
Database Users Result Role List of user’s roles and the databases / collections on which the roles apply. A role allows the user to perform particular actions on the specified database. A role on the admin database can include privileges that apply to the other databases as well. See Roles below for more details.
- Username string
Username for authenticating to MongoDB.
- X509Type string
X.509 method by which the provided username is authenticated.
- auth
Database stringName The user’s authentication database. A user must provide both a username and authentication database to log into MongoDB. In Atlas deployments of MongoDB, the authentication database is always the admin database.
- labels
Get
Database Users Result Label[] - project
Id string The unique ID for the project to get all database users.
- roles
Get
Database Users Result Role[] List of user’s roles and the databases / collections on which the roles apply. A role allows the user to perform particular actions on the specified database. A role on the admin database can include privileges that apply to the other databases as well. See Roles below for more details.
- username string
Username for authenticating to MongoDB.
- x509Type string
X.509 method by which the provided username is authenticated.
- auth_
database_ strname The user’s authentication database. A user must provide both a username and authentication database to log into MongoDB. In Atlas deployments of MongoDB, the authentication database is always the admin database.
- labels
List[Get
Database Users Result Label] - project_
id str The unique ID for the project to get all database users.
- roles
List[Get
Database Users Result Role] List of user’s roles and the databases / collections on which the roles apply. A role allows the user to perform particular actions on the specified database. A role on the admin database can include privileges that apply to the other databases as well. See Roles below for more details.
- username str
Username for authenticating to MongoDB.
- x509_
type str X.509 method by which the provided username is authenticated.
GetDatabaseUsersResultLabel
See the output API doc for this type.
See the output API doc for this type.
See the output API doc for this type.
GetDatabaseUsersResultRole
See the output API doc for this type.
See the output API doc for this type.
See the output API doc for this type.
- Collection
Name string Collection for which the role applies. You can specify a collection for the
readandreadWriteroles. If you do not specify a collection forreadandreadWrite, the role applies to all collections in the database (excluding some collections in thesystem. database).- Database
Name string Database on which the user has the specified role. A role on the
admindatabase can include privileges that apply to the other databases.- Role
Name string
- Collection
Name string Collection for which the role applies. You can specify a collection for the
readandreadWriteroles. If you do not specify a collection forreadandreadWrite, the role applies to all collections in the database (excluding some collections in thesystem. database).- Database
Name string Database on which the user has the specified role. A role on the
admindatabase can include privileges that apply to the other databases.- Role
Name string
- collection
Name string Collection for which the role applies. You can specify a collection for the
readandreadWriteroles. If you do not specify a collection forreadandreadWrite, the role applies to all collections in the database (excluding some collections in thesystem. database).- database
Name string Database on which the user has the specified role. A role on the
admindatabase can include privileges that apply to the other databases.- role
Name string
- collection
Name str Collection for which the role applies. You can specify a collection for the
readandreadWriteroles. If you do not specify a collection forreadandreadWrite, the role applies to all collections in the database (excluding some collections in thesystem. database).- database_
name str Database on which the user has the specified role. A role on the
admindatabase can include privileges that apply to the other databases.- role_
name str
Package Details
- Repository
- https://github.com/pulumi/pulumi-mongodbatlas
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
mongodbatlasTerraform Provider.