DigitalOcean v4.35.0 published on Tuesday, Nov 19, 2024 by Pulumi
digitalocean.getDatabaseUser
Explore with Pulumi AI
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:
- cluster_
id str - The ID of the database cluster.
- name str
- The name of the database user.
getDatabaseUser Result
The following output properties are available:
- Access
Cert string - Access certificate for TLS client authentication. (Kafka only)
- Access
Key string - Access key for TLS client authentication. (Kafka only)
- Cluster
Id string - Id string
- The provider-assigned unique ID for this managed resource.
- Mysql
Auth stringPlugin - The authentication method of the MySQL user. The value will be
mysql_native_password
orcaching_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
ornormal
. - Settings
List<Pulumi.
Digital Ocean. Outputs. Get Database User Setting>
- Access
Cert string - Access certificate for TLS client authentication. (Kafka only)
- Access
Key string - Access key for TLS client authentication. (Kafka only)
- Cluster
Id string - Id string
- The provider-assigned unique ID for this managed resource.
- Mysql
Auth stringPlugin - The authentication method of the MySQL user. The value will be
mysql_native_password
orcaching_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
ornormal
. - Settings
[]Get
Database User Setting
- access
Cert String - Access certificate for TLS client authentication. (Kafka only)
- access
Key String - Access key for TLS client authentication. (Kafka only)
- cluster
Id String - id String
- The provider-assigned unique ID for this managed resource.
- mysql
Auth StringPlugin - The authentication method of the MySQL user. The value will be
mysql_native_password
orcaching_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
ornormal
. - settings
List<Get
Database User Setting>
- access
Cert string - Access certificate for TLS client authentication. (Kafka only)
- access
Key string - Access key for TLS client authentication. (Kafka only)
- cluster
Id string - id string
- The provider-assigned unique ID for this managed resource.
- mysql
Auth stringPlugin - The authentication method of the MySQL user. The value will be
mysql_native_password
orcaching_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
ornormal
. - settings
Get
Database User Setting[]
- 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_ strplugin - The authentication method of the MySQL user. The value will be
mysql_native_password
orcaching_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
ornormal
. - settings
Sequence[Get
Database User Setting]
- access
Cert String - Access certificate for TLS client authentication. (Kafka only)
- access
Key String - Access key for TLS client authentication. (Kafka only)
- cluster
Id String - id String
- The provider-assigned unique ID for this managed resource.
- mysql
Auth StringPlugin - The authentication method of the MySQL user. The value will be
mysql_native_password
orcaching_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
ornormal
. - 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.