1. Packages
  2. Digitalocean Provider
  3. API Docs
  4. getDatabaseUser
DigitalOcean v4.35.0 published on Tuesday, Nov 19, 2024 by Pulumi

digitalocean.getDatabaseUser

Explore with Pulumi AI

digitalocean logo
DigitalOcean v4.35.0 published on Tuesday, Nov 19, 2024 by Pulumi

    Provides information on a DigitalOcean database user resource.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as digitalocean from "@pulumi/digitalocean";
    
    const main = digitalocean.getDatabaseCluster({
        name: "main-cluster",
    });
    const example = main.then(main => digitalocean.getDatabaseUser({
        clusterId: main.id,
        name: "example-user",
    }));
    export const databaseUserPassword = example.then(example => example.password);
    
    import pulumi
    import pulumi_digitalocean as digitalocean
    
    main = digitalocean.get_database_cluster(name="main-cluster")
    example = digitalocean.get_database_user(cluster_id=main.id,
        name="example-user")
    pulumi.export("databaseUserPassword", example.password)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		main, err := digitalocean.LookupDatabaseCluster(ctx, &digitalocean.LookupDatabaseClusterArgs{
    			Name: "main-cluster",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		example, err := digitalocean.LookupDatabaseUser(ctx, &digitalocean.LookupDatabaseUserArgs{
    			ClusterId: main.Id,
    			Name:      "example-user",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("databaseUserPassword", example.Password)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using DigitalOcean = Pulumi.DigitalOcean;
    
    return await Deployment.RunAsync(() => 
    {
        var main = DigitalOcean.GetDatabaseCluster.Invoke(new()
        {
            Name = "main-cluster",
        });
    
        var example = DigitalOcean.GetDatabaseUser.Invoke(new()
        {
            ClusterId = main.Apply(getDatabaseClusterResult => getDatabaseClusterResult.Id),
            Name = "example-user",
        });
    
        return new Dictionary<string, object?>
        {
            ["databaseUserPassword"] = example.Apply(getDatabaseUserResult => getDatabaseUserResult.Password),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.digitalocean.DigitaloceanFunctions;
    import com.pulumi.digitalocean.inputs.GetDatabaseClusterArgs;
    import com.pulumi.digitalocean.inputs.GetDatabaseUserArgs;
    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 main = DigitaloceanFunctions.getDatabaseCluster(GetDatabaseClusterArgs.builder()
                .name("main-cluster")
                .build());
    
            final var example = DigitaloceanFunctions.getDatabaseUser(GetDatabaseUserArgs.builder()
                .clusterId(main.applyValue(getDatabaseClusterResult -> getDatabaseClusterResult.id()))
                .name("example-user")
                .build());
    
            ctx.export("databaseUserPassword", example.applyValue(getDatabaseUserResult -> getDatabaseUserResult.password()));
        }
    }
    
    variables:
      main:
        fn::invoke:
          Function: digitalocean:getDatabaseCluster
          Arguments:
            name: main-cluster
      example:
        fn::invoke:
          Function: digitalocean:getDatabaseUser
          Arguments:
            clusterId: ${main.id}
            name: example-user
    outputs:
      databaseUserPassword: ${example.password}
    

    Using getDatabaseUser

    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 getDatabaseUser(args: GetDatabaseUserArgs, opts?: InvokeOptions): Promise<GetDatabaseUserResult>
    function getDatabaseUserOutput(args: GetDatabaseUserOutputArgs, opts?: InvokeOptions): Output<GetDatabaseUserResult>
    def get_database_user(cluster_id: Optional[str] = None,
                          name: Optional[str] = None,
                          opts: Optional[InvokeOptions] = None) -> GetDatabaseUserResult
    def get_database_user_output(cluster_id: Optional[pulumi.Input[str]] = None,
                          name: Optional[pulumi.Input[str]] = None,
                          opts: Optional[InvokeOptions] = None) -> Output[GetDatabaseUserResult]
    func LookupDatabaseUser(ctx *Context, args *LookupDatabaseUserArgs, opts ...InvokeOption) (*LookupDatabaseUserResult, error)
    func LookupDatabaseUserOutput(ctx *Context, args *LookupDatabaseUserOutputArgs, opts ...InvokeOption) LookupDatabaseUserResultOutput

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

    public static class GetDatabaseUser 
    {
        public static Task<GetDatabaseUserResult> InvokeAsync(GetDatabaseUserArgs args, InvokeOptions? opts = null)
        public static Output<GetDatabaseUserResult> Invoke(GetDatabaseUserInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetDatabaseUserResult> getDatabaseUser(GetDatabaseUserArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: digitalocean:index/getDatabaseUser:getDatabaseUser
      arguments:
        # arguments dictionary

    The following arguments are supported:

    ClusterId string
    The ID of the database cluster.
    Name string
    The name of the database user.
    ClusterId string
    The ID of the database cluster.
    Name string
    The name of the database user.
    clusterId String
    The ID of the database cluster.
    name String
    The name of the database user.
    clusterId string
    The ID of the database cluster.
    name string
    The name of the database user.
    cluster_id str
    The ID of the database cluster.
    name str
    The name of the database user.
    clusterId String
    The ID of the database cluster.
    name String
    The name of the database user.

    getDatabaseUser Result

    The following output properties are available:

    AccessCert string
    Access certificate for TLS client authentication. (Kafka only)
    AccessKey string
    Access key for TLS client authentication. (Kafka only)
    ClusterId string
    Id string
    The provider-assigned unique ID for this managed resource.
    MysqlAuthPlugin string
    The authentication method of the MySQL user. The value will be mysql_native_password or caching_sha2_password.
    Name string
    Password string
    The password of the database user. This will not be set for MongoDB users.
    Role string
    The role of the database user. The value will be either primary or normal.
    Settings List<Pulumi.DigitalOcean.Outputs.GetDatabaseUserSetting>
    AccessCert string
    Access certificate for TLS client authentication. (Kafka only)
    AccessKey string
    Access key for TLS client authentication. (Kafka only)
    ClusterId string
    Id string
    The provider-assigned unique ID for this managed resource.
    MysqlAuthPlugin string
    The authentication method of the MySQL user. The value will be mysql_native_password or caching_sha2_password.
    Name string
    Password string
    The password of the database user. This will not be set for MongoDB users.
    Role string
    The role of the database user. The value will be either primary or normal.
    Settings []GetDatabaseUserSetting
    accessCert String
    Access certificate for TLS client authentication. (Kafka only)
    accessKey String
    Access key for TLS client authentication. (Kafka only)
    clusterId String
    id String
    The provider-assigned unique ID for this managed resource.
    mysqlAuthPlugin String
    The authentication method of the MySQL user. The value will be mysql_native_password or caching_sha2_password.
    name String
    password String
    The password of the database user. This will not be set for MongoDB users.
    role String
    The role of the database user. The value will be either primary or normal.
    settings List<GetDatabaseUserSetting>
    accessCert string
    Access certificate for TLS client authentication. (Kafka only)
    accessKey string
    Access key for TLS client authentication. (Kafka only)
    clusterId string
    id string
    The provider-assigned unique ID for this managed resource.
    mysqlAuthPlugin string
    The authentication method of the MySQL user. The value will be mysql_native_password or caching_sha2_password.
    name string
    password string
    The password of the database user. This will not be set for MongoDB users.
    role string
    The role of the database user. The value will be either primary or normal.
    settings GetDatabaseUserSetting[]
    access_cert str
    Access certificate for TLS client authentication. (Kafka only)
    access_key str
    Access key for TLS client authentication. (Kafka only)
    cluster_id str
    id str
    The provider-assigned unique ID for this managed resource.
    mysql_auth_plugin str
    The authentication method of the MySQL user. The value will be mysql_native_password or caching_sha2_password.
    name str
    password str
    The password of the database user. This will not be set for MongoDB users.
    role str
    The role of the database user. The value will be either primary or normal.
    settings Sequence[GetDatabaseUserSetting]
    accessCert String
    Access certificate for TLS client authentication. (Kafka only)
    accessKey String
    Access key for TLS client authentication. (Kafka only)
    clusterId String
    id String
    The provider-assigned unique ID for this managed resource.
    mysqlAuthPlugin String
    The authentication method of the MySQL user. The value will be mysql_native_password or caching_sha2_password.
    name String
    password String
    The password of the database user. This will not be set for MongoDB users.
    role String
    The role of the database user. The value will be either primary or normal.
    settings List<Property Map>

    Supporting Types

    GetDatabaseUserSetting

    GetDatabaseUserSettingAcl

    Id string
    Permission string
    Topic string
    Id string
    Permission string
    Topic string
    id String
    permission String
    topic String
    id string
    permission string
    topic string
    id str
    permission str
    topic str
    id String
    permission String
    topic String

    Package Details

    Repository
    DigitalOcean pulumi/pulumi-digitalocean
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the digitalocean Terraform Provider.
    digitalocean logo
    DigitalOcean v4.35.0 published on Tuesday, Nov 19, 2024 by Pulumi