MongoDB Atlas

Pulumi Official
Package maintained by Pulumi
v3.5.0 published on Wednesday, Jul 20, 2022 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.Invoke(new Mongodbatlas.Get509AuthenticationDatabaseUserInvokeArgs
            {
                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: DatabaseUserRoleArray{
				&DatabaseUserRoleArgs{
					RoleName:     pulumi.String("atlasAdmin"),
					DatabaseName: pulumi.String("admin"),
				},
			},
			Labels: DatabaseUserLabelArray{
				&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
	})
}

Coming soon!

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_output(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.get509AuthenticationDatabaseUserOutput({
    projectId: projectId,
    username: username,
}));

Coming soon!

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 = Mongodbatlas.Get509AuthenticationDatabaseUser.Invoke(new Mongodbatlas.Get509AuthenticationDatabaseUserInvokeArgs
        {
            ProjectId = testX509AuthenticationDatabaseUser.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
		}
		_ = mongodbatlas.Get509AuthenticationDatabaseUserOutput(ctx, Get509AuthenticationDatabaseUserOutputArgs{
			ProjectId: testX509AuthenticationDatabaseUser.ProjectId,
		}, nil)
		return nil
	})
}

Coming soon!

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 = mongodbatlas.get509_authentication_database_user_output(project_id=test_x509_authentication_database_user.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 = mongodbatlas.get509AuthenticationDatabaseUserOutput({
    projectId: testX509AuthenticationDatabaseUser.projectId,
});

Coming soon!

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)
}
public static CompletableFuture<Get509AuthenticationDatabaseUserResult> get509AuthenticationDatabaseUser(Get509AuthenticationDatabaseUserArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: mongodbatlas:index/get509AuthenticationDatabaseUser:get509AuthenticationDatabaseUser
  Arguments:
    # Arguments dictionary

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.

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.

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.

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 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 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
certificates List<Property Map>

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

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 Integer
notAfter String
subject String
createdAt string
groupId string
id number
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.