1. Packages
  2. Ionoscloud
  3. API Docs
  4. dbaas
  5. getMongoUser
IonosCloud v0.2.2 published on Monday, May 12, 2025 by ionos-cloud

ionoscloud.dbaas.getMongoUser

Explore with Pulumi AI

ionoscloud logo
IonosCloud v0.2.2 published on Monday, May 12, 2025 by ionos-cloud

    The DbaaS Mongo User data source can be used to search for and return an existing DbaaS MongoDB User. If a single match is found, it will be returned. If your search results in multiple matches, an error will be returned. When this happens, please refine your search string so that it is specific enough to return only one result.

    Example Usage

    By username

    import * as pulumi from "@pulumi/pulumi";
    import * as ionoscloud from "@pulumi/ionoscloud";
    
    const example = ionoscloud.dbaas.getMongoUser({
        clusterId: "cluster_id",
        username: "username",
    });
    
    import pulumi
    import pulumi_ionoscloud as ionoscloud
    
    example = ionoscloud.dbaas.get_mongo_user(cluster_id="cluster_id",
        username="username")
    
    package main
    
    import (
    	"github.com/ionos-cloud/pulumi-ionoscloud/sdk/go/ionoscloud/dbaas"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := dbaas.LookupMongoUser(ctx, &dbaas.LookupMongoUserArgs{
    			ClusterId: "cluster_id",
    			Username:  "username",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ionoscloud = Pulumi.Ionoscloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Ionoscloud.Dbaas.GetMongoUser.Invoke(new()
        {
            ClusterId = "cluster_id",
            Username = "username",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ionoscloud.dbaas.DbaasFunctions;
    import com.pulumi.ionoscloud.dbaas.inputs.GetMongoUserArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var example = DbaasFunctions.getMongoUser(GetMongoUserArgs.builder()
                .clusterId("cluster_id")
                .username("username")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: ionoscloud:dbaas:getMongoUser
          arguments:
            clusterId: cluster_id
            username: username
    

    Using getMongoUser

    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 getMongoUser(args: GetMongoUserArgs, opts?: InvokeOptions): Promise<GetMongoUserResult>
    function getMongoUserOutput(args: GetMongoUserOutputArgs, opts?: InvokeOptions): Output<GetMongoUserResult>
    def get_mongo_user(cluster_id: Optional[str] = None,
                       database: Optional[str] = None,
                       id: Optional[str] = None,
                       roles: Optional[Sequence[GetMongoUserRole]] = None,
                       username: Optional[str] = None,
                       opts: Optional[InvokeOptions] = None) -> GetMongoUserResult
    def get_mongo_user_output(cluster_id: Optional[pulumi.Input[str]] = None,
                       database: Optional[pulumi.Input[str]] = None,
                       id: Optional[pulumi.Input[str]] = None,
                       roles: Optional[pulumi.Input[Sequence[pulumi.Input[GetMongoUserRoleArgs]]]] = None,
                       username: Optional[pulumi.Input[str]] = None,
                       opts: Optional[InvokeOptions] = None) -> Output[GetMongoUserResult]
    func LookupMongoUser(ctx *Context, args *LookupMongoUserArgs, opts ...InvokeOption) (*LookupMongoUserResult, error)
    func LookupMongoUserOutput(ctx *Context, args *LookupMongoUserOutputArgs, opts ...InvokeOption) LookupMongoUserResultOutput

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

    public static class GetMongoUser 
    {
        public static Task<GetMongoUserResult> InvokeAsync(GetMongoUserArgs args, InvokeOptions? opts = null)
        public static Output<GetMongoUserResult> Invoke(GetMongoUserInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetMongoUserResult> getMongoUser(GetMongoUserArgs args, InvokeOptions options)
    public static Output<GetMongoUserResult> getMongoUser(GetMongoUserArgs args, InvokeOptions options)
    
    fn::invoke:
      function: ionoscloud:dbaas/getMongoUser:getMongoUser
      arguments:
        # arguments dictionary

    The following arguments are supported:

    ClusterId string
    [string] The unique ID of the cluster. Updates to the value of the field force the cluster to be re-created.
    Username string
    [string] Used for authentication. Updates to the value of the field force the cluster to be re-created.
    Database string
    [string] The user database to use for authentication. Updates to the value of the field force the cluster to be re-created.
    Id string
    Roles List<Ionoscloud.GetMongoUserRole>
    [string] a list of mongodb user roles. Updates to the value of the field force the cluster to be re-created.
    ClusterId string
    [string] The unique ID of the cluster. Updates to the value of the field force the cluster to be re-created.
    Username string
    [string] Used for authentication. Updates to the value of the field force the cluster to be re-created.
    Database string
    [string] The user database to use for authentication. Updates to the value of the field force the cluster to be re-created.
    Id string
    Roles []GetMongoUserRole
    [string] a list of mongodb user roles. Updates to the value of the field force the cluster to be re-created.
    clusterId String
    [string] The unique ID of the cluster. Updates to the value of the field force the cluster to be re-created.
    username String
    [string] Used for authentication. Updates to the value of the field force the cluster to be re-created.
    database String
    [string] The user database to use for authentication. Updates to the value of the field force the cluster to be re-created.
    id String
    roles List<GetMongoUserRole>
    [string] a list of mongodb user roles. Updates to the value of the field force the cluster to be re-created.
    clusterId string
    [string] The unique ID of the cluster. Updates to the value of the field force the cluster to be re-created.
    username string
    [string] Used for authentication. Updates to the value of the field force the cluster to be re-created.
    database string
    [string] The user database to use for authentication. Updates to the value of the field force the cluster to be re-created.
    id string
    roles GetMongoUserRole[]
    [string] a list of mongodb user roles. Updates to the value of the field force the cluster to be re-created.
    cluster_id str
    [string] The unique ID of the cluster. Updates to the value of the field force the cluster to be re-created.
    username str
    [string] Used for authentication. Updates to the value of the field force the cluster to be re-created.
    database str
    [string] The user database to use for authentication. Updates to the value of the field force the cluster to be re-created.
    id str
    roles Sequence[GetMongoUserRole]
    [string] a list of mongodb user roles. Updates to the value of the field force the cluster to be re-created.
    clusterId String
    [string] The unique ID of the cluster. Updates to the value of the field force the cluster to be re-created.
    username String
    [string] Used for authentication. Updates to the value of the field force the cluster to be re-created.
    database String
    [string] The user database to use for authentication. Updates to the value of the field force the cluster to be re-created.
    id String
    roles List<Property Map>
    [string] a list of mongodb user roles. Updates to the value of the field force the cluster to be re-created.

    getMongoUser Result

    The following output properties are available:

    Supporting Types

    GetMongoUserRole

    Database string

    [true] Database on which to apply the role.

    NOTE: MongoDb users do not support update at the moment. Changing any attribute will result in the user being re-created.

    Role string
    [true] Mongodb user role. Examples: read, readWrite, readAnyDatabase, readWriteAnyDatabase, dbAdmin, dbAdminAnyDatabase, clusterMonitor and enableSharding.
    Database string

    [true] Database on which to apply the role.

    NOTE: MongoDb users do not support update at the moment. Changing any attribute will result in the user being re-created.

    Role string
    [true] Mongodb user role. Examples: read, readWrite, readAnyDatabase, readWriteAnyDatabase, dbAdmin, dbAdminAnyDatabase, clusterMonitor and enableSharding.
    database String

    [true] Database on which to apply the role.

    NOTE: MongoDb users do not support update at the moment. Changing any attribute will result in the user being re-created.

    role String
    [true] Mongodb user role. Examples: read, readWrite, readAnyDatabase, readWriteAnyDatabase, dbAdmin, dbAdminAnyDatabase, clusterMonitor and enableSharding.
    database string

    [true] Database on which to apply the role.

    NOTE: MongoDb users do not support update at the moment. Changing any attribute will result in the user being re-created.

    role string
    [true] Mongodb user role. Examples: read, readWrite, readAnyDatabase, readWriteAnyDatabase, dbAdmin, dbAdminAnyDatabase, clusterMonitor and enableSharding.
    database str

    [true] Database on which to apply the role.

    NOTE: MongoDb users do not support update at the moment. Changing any attribute will result in the user being re-created.

    role str
    [true] Mongodb user role. Examples: read, readWrite, readAnyDatabase, readWriteAnyDatabase, dbAdmin, dbAdminAnyDatabase, clusterMonitor and enableSharding.
    database String

    [true] Database on which to apply the role.

    NOTE: MongoDb users do not support update at the moment. Changing any attribute will result in the user being re-created.

    role String
    [true] Mongodb user role. Examples: read, readWrite, readAnyDatabase, readWriteAnyDatabase, dbAdmin, dbAdminAnyDatabase, clusterMonitor and enableSharding.

    Package Details

    Repository
    ionoscloud ionos-cloud/pulumi-ionoscloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the ionoscloud Terraform Provider.
    ionoscloud logo
    IonosCloud v0.2.2 published on Monday, May 12, 2025 by ionos-cloud