Want to learn about running containers in Lambda? Join our free hands-on workshop. Register Now

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
        {
            DatabaseName = "$external",
            Labels = 
            {
                new Mongodbatlas.Inputs.DatabaseUserLabelArgs
                {
                    Key = "My Key",
                    Value = "My Value",
                },
            },
            ProjectId = "<PROJECT-ID>",
            Roles = 
            {
                new Mongodbatlas.Inputs.DatabaseUserRoleArgs
                {
                    DatabaseName = "admin",
                    RoleName = "atlasAdmin",
                },
            },
            Username = "myUsername",
            X509Type = "MANAGED",
        });
        var testX509AuthenticationDatabaseUser = new Mongodbatlas.X509AuthenticationDatabaseUser("testX509AuthenticationDatabaseUser", new Mongodbatlas.X509AuthenticationDatabaseUserArgs
        {
            MonthsUntilExpiration = 2,
            ProjectId = user.ProjectId,
            Username = user.Username,
        });
        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/go/mongodbatlas"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

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

user = mongodbatlas.DatabaseUser("user",
    database_name="$external",
    labels=[mongodbatlas.DatabaseUserLabelArgs(
        key="My Key",
        value="My Value",
    )],
    project_id="<PROJECT-ID>",
    roles=[mongodbatlas.DatabaseUserRoleArgs(
        database_name="admin",
        role_name="atlasAdmin",
    )],
    username="myUsername",
    x509_type="MANAGED")
test_x509_authentication_database_user = mongodbatlas.X509AuthenticationDatabaseUser("testX509AuthenticationDatabaseUser",
    months_until_expiration=2,
    project_id=user.project_id,
    username=user.username)
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", {
    databaseName: "$external",
    labels: [{
        key: "My Key",
        value: "My Value",
    }],
    projectId: "<PROJECT-ID>",
    roles: [{
        databaseName: "admin",
        roleName: "atlasAdmin",
    }],
    username: "myUsername",
    x509Type: "MANAGED",
});
const testX509AuthenticationDatabaseUser = new mongodbatlas.X509AuthenticationDatabaseUser("test", {
    monthsUntilExpiration: 2,
    projectId: user.projectId,
    username: user.username,
});
const test509AuthenticationDatabaseUser = pulumi.all([testX509AuthenticationDatabaseUser.projectId, testX509AuthenticationDatabaseUser.username]).apply(([projectId, username]) => mongodbatlas.get509AuthenticationDatabaseUser({
    projectId: projectId,
    username: username,
}, { async: true }));

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
        {
            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-----""

",
            ProjectId = "<PROJECT-ID>",
        });
        var test509AuthenticationDatabaseUser = testX509AuthenticationDatabaseUser.ProjectId.Apply(projectId => Mongodbatlas.Get509AuthenticationDatabaseUser.InvokeAsync(new Mongodbatlas.Get509AuthenticationDatabaseUserArgs
        {
            ProjectId = projectId,
        }));
    }

}
package main

import (
    "fmt"

    "github.com/pulumi/pulumi-mongodbatlas/sdk/go/mongodbatlas"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        testX509AuthenticationDatabaseUser, err := mongodbatlas.NewX509AuthenticationDatabaseUser(ctx, "testX509AuthenticationDatabaseUser", &mongodbatlas.X509AuthenticationDatabaseUserArgs{
            CustomerX509Cas: pulumi.String(fmt.Sprintf("%v%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", "\n")),
            ProjectId:       pulumi.String("<PROJECT-ID>"),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_mongodbatlas as mongodbatlas

test_x509_authentication_database_user = mongodbatlas.X509AuthenticationDatabaseUser("testX509AuthenticationDatabaseUser",
    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-----"

""",
    project_id="<PROJECT-ID>")
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("test", {
    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-----"
`,
    projectId: "<PROJECT-ID>",
});
const test509AuthenticationDatabaseUser = testX509AuthenticationDatabaseUser.projectId.apply(projectId => mongodbatlas.get509AuthenticationDatabaseUser({
    projectId: projectId,
}, { async: true }));

Using Get509AuthenticationDatabaseUser

function get509AuthenticationDatabaseUser(args: Get509AuthenticationDatabaseUserArgs, opts?: InvokeOptions): Promise<Get509AuthenticationDatabaseUserResult>
def get509_authentication_database_user(project_id: Optional[str] = None, username: Optional[str] = None, opts: Optional[InvokeOptions] = None) -> Get509AuthenticationDatabaseUserResult
func Get509AuthenticationDatabaseUser(ctx *Context, args *Get509AuthenticationDatabaseUserArgs, opts ...InvokeOption) (*Get509AuthenticationDatabaseUserResult, error)
public static class Get509AuthenticationDatabaseUser {
    public static Task<Get509AuthenticationDatabaseUserResult> InvokeAsync(Get509AuthenticationDatabaseUserArgs 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

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

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
created_at str
group_id str
id int
not_after str
subject str

Package Details

Repository
https://github.com/pulumi/pulumi-mongodbatlas
License
Apache-2.0
Notes
This Pulumi package is based on the mongodbatlas Terraform Provider.