Welcome to Pulumi Registry, your window into the cloud. Read the announcement.

MongoDB Atlas

v3.0.1 published on Monday, Nov 1, 2021 by Pulumi

get509AuthenticationDatabaseUser

mongodbatlas.X509AuthenticationDatabaseUser describe a X509 Authentication Database User. This represents a X509 Authentication Database User.

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

Example Usage

Example Usage: Generate an Atlas-managed X.509 certificate for a MongoDB user

using Pulumi;
using Mongodbatlas = Pulumi.Mongodbatlas;

class MyStack : Stack
{
    public MyStack()
    {
        var user = new Mongodbatlas.DatabaseUser("user", new Mongodbatlas.DatabaseUserArgs
        {
            ProjectId = "<PROJECT-ID>",
            Username = "myUsername",
            X509Type = "MANAGED",
            DatabaseName = "$external",
            Roles = 
            {
                new Mongodbatlas.Inputs.DatabaseUserRoleArgs
                {
                    RoleName = "atlasAdmin",
                    DatabaseName = "admin",
                },
            },
            Labels = 
            {
                new Mongodbatlas.Inputs.DatabaseUserLabelArgs
                {
                    Key = "My Key",
                    Value = "My Value",
                },
            },
        });
        var testX509AuthenticationDatabaseUser = new Mongodbatlas.X509AuthenticationDatabaseUser("testX509AuthenticationDatabaseUser", new Mongodbatlas.X509AuthenticationDatabaseUserArgs
        {
            ProjectId = user.ProjectId,
            Username = user.Username,
            MonthsUntilExpiration = 2,
        });
        var test509AuthenticationDatabaseUser = Output.Tuple(testX509AuthenticationDatabaseUser.ProjectId, testX509AuthenticationDatabaseUser.Username).Apply(values =>
        {
            var projectId = values.Item1;
            var username = values.Item2;
            return Mongodbatlas.Get509AuthenticationDatabaseUser.InvokeAsync(new Mongodbatlas.Get509AuthenticationDatabaseUserArgs
            {
                ProjectId = projectId,
                Username = username,
            });
        });
    }

}
package main

import (
	"fmt"

	"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 {
		user, err := mongodbatlas.NewDatabaseUser(ctx, "user", &mongodbatlas.DatabaseUserArgs{
			ProjectId:    pulumi.String("<PROJECT-ID>"),
			Username:     pulumi.String("myUsername"),
			X509Type:     pulumi.String("MANAGED"),
			DatabaseName: pulumi.String(fmt.Sprintf("%v%v", "$", "external")),
			Roles: mongodbatlas.DatabaseUserRoleArray{
				&mongodbatlas.DatabaseUserRoleArgs{
					RoleName:     pulumi.String("atlasAdmin"),
					DatabaseName: pulumi.String("admin"),
				},
			},
			Labels: mongodbatlas.DatabaseUserLabelArray{
				&mongodbatlas.DatabaseUserLabelArgs{
					Key:   pulumi.String("My Key"),
					Value: pulumi.String("My Value"),
				},
			},
		})
		if err != nil {
			return err
		}
		testX509AuthenticationDatabaseUser, err := mongodbatlas.NewX509AuthenticationDatabaseUser(ctx, "testX509AuthenticationDatabaseUser", &mongodbatlas.X509AuthenticationDatabaseUserArgs{
			ProjectId:             user.ProjectId,
			Username:              user.Username,
			MonthsUntilExpiration: pulumi.Int(2),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_mongodbatlas as mongodbatlas

user = mongodbatlas.DatabaseUser("user",
    project_id="<PROJECT-ID>",
    username="myUsername",
    x509_type="MANAGED",
    database_name="$external",
    roles=[mongodbatlas.DatabaseUserRoleArgs(
        role_name="atlasAdmin",
        database_name="admin",
    )],
    labels=[mongodbatlas.DatabaseUserLabelArgs(
        key="My Key",
        value="My Value",
    )])
test_x509_authentication_database_user = mongodbatlas.X509AuthenticationDatabaseUser("testX509AuthenticationDatabaseUser",
    project_id=user.project_id,
    username=user.username,
    months_until_expiration=2)
test509_authentication_database_user = pulumi.Output.all(test_x509_authentication_database_user.project_id, test_x509_authentication_database_user.username).apply(lambda project_id, username: mongodbatlas.get509_authentication_database_user(project_id=project_id,
    username=username))
import * as pulumi from "@pulumi/pulumi";
import * as mongodbatlas from "@pulumi/mongodbatlas";

const user = new mongodbatlas.DatabaseUser("user", {
    projectId: "<PROJECT-ID>",
    username: "myUsername",
    x509Type: "MANAGED",
    databaseName: `$external`,
    roles: [{
        roleName: "atlasAdmin",
        databaseName: "admin",
    }],
    labels: [{
        key: "My Key",
        value: "My Value",
    }],
});
const testX509AuthenticationDatabaseUser = new mongodbatlas.X509AuthenticationDatabaseUser("testX509AuthenticationDatabaseUser", {
    projectId: user.projectId,
    username: user.username,
    monthsUntilExpiration: 2,
});
const test509AuthenticationDatabaseUser = pulumi.all([testX509AuthenticationDatabaseUser.projectId, testX509AuthenticationDatabaseUser.username]).apply(([projectId, username]) => mongodbatlas.get509AuthenticationDatabaseUser({
    projectId: projectId,
    username: username,
}));

Example Usage: Save a customer-managed X.509 configuration for an Atlas project

using Pulumi;
using Mongodbatlas = Pulumi.Mongodbatlas;

class MyStack : Stack
{
    public MyStack()
    {
        var testX509AuthenticationDatabaseUser = new Mongodbatlas.X509AuthenticationDatabaseUser("testX509AuthenticationDatabaseUser", new Mongodbatlas.X509AuthenticationDatabaseUserArgs
        {
            ProjectId = "<PROJECT-ID>",
            CustomerX509Cas = @"-----BEGIN CERTIFICATE-----
MIICmTCCAgICCQDZnHzklxsT9TANBgkqhkiG9w0BAQsFADCBkDELMAkGA1UEBhMC
VVMxDjAMBgNVBAgMBVRleGFzMQ8wDQYDVQQHDAZBdXN0aW4xETAPBgNVBAoMCHRl
c3QuY29tMQ0wCwYDVQQLDARUZXN0MREwDwYDVQQDDAh0ZXN0LmNvbTErMCkGCSqG
SIb3DQEJARYcbWVsaXNzYS5wbHVua2V0dEBtb25nb2RiLmNvbTAeFw0yMDAyMDQy
MDQ2MDFaFw0yMTAyMDMyMDQ2MDFaMIGQMQswCQYDVQQGEwJVUzEOMAwGA1UECAwF
VGV4YXMxDzANBgNVBAcMBkF1c3RpbjERMA8GA1UECgwIdGVzdC5jb20xDTALBgNV
BAsMBFRlc3QxETAPBgNVBAMMCHRlc3QuY29tMSswKQYJKoZIhvcNAQkBFhxtZWxp
c3NhLnBsdW5rZXR0QG1vbmdvZGIuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCB
iQKBgQCf1LRqr1zftzdYx2Aj9G76tb0noMPtj6faGLlPji1+m6Rn7RWD9L0ntWAr
cURxvypa9jZ9MXFzDtLevvd3tHEmfrUT3ukNDX6+Jtc4kWm+Dh2A70Pd+deKZ2/O
Fh8audEKAESGXnTbeJCeQa1XKlIkjqQHBNwES5h1b9vJtFoLJwIDAQABMA0GCSqG
SIb3DQEBCwUAA4GBADMUncjEPV/MiZUcVNGmktP6BPmEqMXQWUDpdGW2+Tg2JtUA
7MMILtepBkFzLO+GlpZxeAlXO0wxiNgEmCRONgh4+t2w3e7a8GFijYQ99FHrAC5A
iul59bdl18gVqXia1Yeq/iK7Ohfy/Jwd7Hsm530elwkM/ZEkYDjBlZSXYdyz
-----END CERTIFICATE-----""
",
        });
        var test509AuthenticationDatabaseUser = testX509AuthenticationDatabaseUser.ProjectId.Apply(projectId => Mongodbatlas.Get509AuthenticationDatabaseUser.InvokeAsync(new Mongodbatlas.Get509AuthenticationDatabaseUserArgs
        {
            ProjectId = projectId,
        }));
    }

}
package main

import (
	"fmt"

	"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 {
		testX509AuthenticationDatabaseUser, err := mongodbatlas.NewX509AuthenticationDatabaseUser(ctx, "testX509AuthenticationDatabaseUser", &mongodbatlas.X509AuthenticationDatabaseUserArgs{
			ProjectId:       pulumi.String("<PROJECT-ID>"),
			CustomerX509Cas: pulumi.String(fmt.Sprintf("%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v", "-----BEGIN CERTIFICATE-----\n", "MIICmTCCAgICCQDZnHzklxsT9TANBgkqhkiG9w0BAQsFADCBkDELMAkGA1UEBhMC\n", "VVMxDjAMBgNVBAgMBVRleGFzMQ8wDQYDVQQHDAZBdXN0aW4xETAPBgNVBAoMCHRl\n", "c3QuY29tMQ0wCwYDVQQLDARUZXN0MREwDwYDVQQDDAh0ZXN0LmNvbTErMCkGCSqG\n", "SIb3DQEJARYcbWVsaXNzYS5wbHVua2V0dEBtb25nb2RiLmNvbTAeFw0yMDAyMDQy\n", "MDQ2MDFaFw0yMTAyMDMyMDQ2MDFaMIGQMQswCQYDVQQGEwJVUzEOMAwGA1UECAwF\n", "VGV4YXMxDzANBgNVBAcMBkF1c3RpbjERMA8GA1UECgwIdGVzdC5jb20xDTALBgNV\n", "BAsMBFRlc3QxETAPBgNVBAMMCHRlc3QuY29tMSswKQYJKoZIhvcNAQkBFhxtZWxp\n", "c3NhLnBsdW5rZXR0QG1vbmdvZGIuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCB\n", "iQKBgQCf1LRqr1zftzdYx2Aj9G76tb0noMPtj6faGLlPji1+m6Rn7RWD9L0ntWAr\n", "cURxvypa9jZ9MXFzDtLevvd3tHEmfrUT3ukNDX6+Jtc4kWm+Dh2A70Pd+deKZ2/O\n", "Fh8audEKAESGXnTbeJCeQa1XKlIkjqQHBNwES5h1b9vJtFoLJwIDAQABMA0GCSqG\n", "SIb3DQEBCwUAA4GBADMUncjEPV/MiZUcVNGmktP6BPmEqMXQWUDpdGW2+Tg2JtUA\n", "7MMILtepBkFzLO+GlpZxeAlXO0wxiNgEmCRONgh4+t2w3e7a8GFijYQ99FHrAC5A\n", "iul59bdl18gVqXia1Yeq/iK7Ohfy/Jwd7Hsm530elwkM/ZEkYDjBlZSXYdyz\n", "-----END CERTIFICATE-----\"\n")),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_mongodbatlas as mongodbatlas

test_x509_authentication_database_user = mongodbatlas.X509AuthenticationDatabaseUser("testX509AuthenticationDatabaseUser",
    project_id="<PROJECT-ID>",
    customer_x509_cas="""-----BEGIN CERTIFICATE-----
MIICmTCCAgICCQDZnHzklxsT9TANBgkqhkiG9w0BAQsFADCBkDELMAkGA1UEBhMC
VVMxDjAMBgNVBAgMBVRleGFzMQ8wDQYDVQQHDAZBdXN0aW4xETAPBgNVBAoMCHRl
c3QuY29tMQ0wCwYDVQQLDARUZXN0MREwDwYDVQQDDAh0ZXN0LmNvbTErMCkGCSqG
SIb3DQEJARYcbWVsaXNzYS5wbHVua2V0dEBtb25nb2RiLmNvbTAeFw0yMDAyMDQy
MDQ2MDFaFw0yMTAyMDMyMDQ2MDFaMIGQMQswCQYDVQQGEwJVUzEOMAwGA1UECAwF
VGV4YXMxDzANBgNVBAcMBkF1c3RpbjERMA8GA1UECgwIdGVzdC5jb20xDTALBgNV
BAsMBFRlc3QxETAPBgNVBAMMCHRlc3QuY29tMSswKQYJKoZIhvcNAQkBFhxtZWxp
c3NhLnBsdW5rZXR0QG1vbmdvZGIuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCB
iQKBgQCf1LRqr1zftzdYx2Aj9G76tb0noMPtj6faGLlPji1+m6Rn7RWD9L0ntWAr
cURxvypa9jZ9MXFzDtLevvd3tHEmfrUT3ukNDX6+Jtc4kWm+Dh2A70Pd+deKZ2/O
Fh8audEKAESGXnTbeJCeQa1XKlIkjqQHBNwES5h1b9vJtFoLJwIDAQABMA0GCSqG
SIb3DQEBCwUAA4GBADMUncjEPV/MiZUcVNGmktP6BPmEqMXQWUDpdGW2+Tg2JtUA
7MMILtepBkFzLO+GlpZxeAlXO0wxiNgEmCRONgh4+t2w3e7a8GFijYQ99FHrAC5A
iul59bdl18gVqXia1Yeq/iK7Ohfy/Jwd7Hsm530elwkM/ZEkYDjBlZSXYdyz
-----END CERTIFICATE-----"
""")
test509_authentication_database_user = test_x509_authentication_database_user.project_id.apply(lambda project_id: mongodbatlas.get509_authentication_database_user(project_id=project_id))
import * as pulumi from "@pulumi/pulumi";
import * as mongodbatlas from "@pulumi/mongodbatlas";

const testX509AuthenticationDatabaseUser = new mongodbatlas.X509AuthenticationDatabaseUser("testX509AuthenticationDatabaseUser", {
    projectId: "<PROJECT-ID>",
    customerX509Cas: `-----BEGIN CERTIFICATE-----
MIICmTCCAgICCQDZnHzklxsT9TANBgkqhkiG9w0BAQsFADCBkDELMAkGA1UEBhMC
VVMxDjAMBgNVBAgMBVRleGFzMQ8wDQYDVQQHDAZBdXN0aW4xETAPBgNVBAoMCHRl
c3QuY29tMQ0wCwYDVQQLDARUZXN0MREwDwYDVQQDDAh0ZXN0LmNvbTErMCkGCSqG
SIb3DQEJARYcbWVsaXNzYS5wbHVua2V0dEBtb25nb2RiLmNvbTAeFw0yMDAyMDQy
MDQ2MDFaFw0yMTAyMDMyMDQ2MDFaMIGQMQswCQYDVQQGEwJVUzEOMAwGA1UECAwF
VGV4YXMxDzANBgNVBAcMBkF1c3RpbjERMA8GA1UECgwIdGVzdC5jb20xDTALBgNV
BAsMBFRlc3QxETAPBgNVBAMMCHRlc3QuY29tMSswKQYJKoZIhvcNAQkBFhxtZWxp
c3NhLnBsdW5rZXR0QG1vbmdvZGIuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCB
iQKBgQCf1LRqr1zftzdYx2Aj9G76tb0noMPtj6faGLlPji1+m6Rn7RWD9L0ntWAr
cURxvypa9jZ9MXFzDtLevvd3tHEmfrUT3ukNDX6+Jtc4kWm+Dh2A70Pd+deKZ2/O
Fh8audEKAESGXnTbeJCeQa1XKlIkjqQHBNwES5h1b9vJtFoLJwIDAQABMA0GCSqG
SIb3DQEBCwUAA4GBADMUncjEPV/MiZUcVNGmktP6BPmEqMXQWUDpdGW2+Tg2JtUA
7MMILtepBkFzLO+GlpZxeAlXO0wxiNgEmCRONgh4+t2w3e7a8GFijYQ99FHrAC5A
iul59bdl18gVqXia1Yeq/iK7Ohfy/Jwd7Hsm530elwkM/ZEkYDjBlZSXYdyz
-----END CERTIFICATE-----"
`,
});
const test509AuthenticationDatabaseUser = testX509AuthenticationDatabaseUser.projectId.apply(projectId => mongodbatlas.get509AuthenticationDatabaseUser({
    projectId: projectId,
}));

Using get509AuthenticationDatabaseUser

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 get509AuthenticationDatabaseUser(args: Get509AuthenticationDatabaseUserArgs, opts?: InvokeOptions): Promise<Get509AuthenticationDatabaseUserResult>
function get509AuthenticationDatabaseUserOutput(args: Get509AuthenticationDatabaseUserOutputArgs, opts?: InvokeOptions): Output<Get509AuthenticationDatabaseUserResult>
def get509_authentication_database_user(project_id: Optional[str] = None,
                                        username: Optional[str] = None,
                                        opts: Optional[InvokeOptions] = None) -> Get509AuthenticationDatabaseUserResult
def get509_authentication_database_user_output(project_id: Optional[pulumi.Input[str]] = None,
                                        username: Optional[pulumi.Input[str]] = None,
                                        opts: Optional[InvokeOptions] = None) -> Output[Get509AuthenticationDatabaseUserResult]
func Get509AuthenticationDatabaseUser(ctx *Context, args *Get509AuthenticationDatabaseUserArgs, opts ...InvokeOption) (*Get509AuthenticationDatabaseUserResult, error)
func Get509AuthenticationDatabaseUserOutput(ctx *Context, args *Get509AuthenticationDatabaseUserOutputArgs, opts ...InvokeOption) Get509AuthenticationDatabaseUserResultOutput

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

public static class Get509AuthenticationDatabaseUser 
{
    public static Task<Get509AuthenticationDatabaseUserResult> InvokeAsync(Get509AuthenticationDatabaseUserArgs args, InvokeOptions? opts = null)
    public static Output<Get509AuthenticationDatabaseUserResult> Invoke(Get509AuthenticationDatabaseUserInvokeArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

ProjectId string
Identifier for the Atlas project associated with the X.509 configuration.
Username string
Username of the database user to create a certificate for.
ProjectId string
Identifier for the Atlas project associated with the X.509 configuration.
Username string
Username of the database user to create a certificate for.
projectId string
Identifier for the Atlas project associated with the X.509 configuration.
username string
Username of the database user to create a certificate for.
project_id str
Identifier for the Atlas project associated with the X.509 configuration.
username str
Username of the database user to create a certificate for.

get509AuthenticationDatabaseUser Result

The following output properties are available:

Certificates List<Get509AuthenticationDatabaseUserCertificate>
Array of objects where each details one unexpired database user certificate.
CustomerX509Cas string
Id string
The provider-assigned unique ID for this managed resource.
ProjectId string
Username string
Certificates []Get509AuthenticationDatabaseUserCertificate
Array of objects where each details one unexpired database user certificate.
CustomerX509Cas string
Id string
The provider-assigned unique ID for this managed resource.
ProjectId string
Username string
certificates Get509AuthenticationDatabaseUserCertificate[]
Array of objects where each details one unexpired database user certificate.
customerX509Cas string
id string
The provider-assigned unique ID for this managed resource.
projectId string
username string
certificates Sequence[Get509AuthenticationDatabaseUserCertificate]
Array of objects where each details one unexpired database user certificate.
customer_x509_cas str
id str
The provider-assigned unique ID for this managed resource.
project_id str
username str

Supporting Types

Get509AuthenticationDatabaseUserCertificate

CreatedAt string
GroupId string
Id int
NotAfter string
Subject string
CreatedAt string
GroupId string
Id int
NotAfter string
Subject string
createdAt string
groupId string
id number
notAfter string
subject 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.