DigitalOcean

Pulumi Official
Package maintained by Pulumi
v4.15.0 published on Tuesday, Aug 16, 2022 by Pulumi

getDatabaseReplica

Provides information on a DigitalOcean database replica.

Example Usage

using System.Collections.Generic;
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;

return await Deployment.RunAsync(() => 
{
    var example = DigitalOcean.GetDatabaseCluster.Invoke(new()
    {
        Name = "example-cluster",
    });

    var read_only = DigitalOcean.GetDatabaseReplica.Invoke(new()
    {
        ClusterId = example.Apply(getDatabaseClusterResult => getDatabaseClusterResult.Id),
        Name = "terra-test-ro",
    });

    return new Dictionary<string, object?>
    {
        ["replicaOutput"] = read_only.Apply(getDatabaseReplicaResult => getDatabaseReplicaResult).Apply(read_only => read_only.Apply(getDatabaseReplicaResult => getDatabaseReplicaResult.Uri)),
    };
});
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 {
		example, err := digitalocean.LookupDatabaseCluster(ctx, &GetDatabaseClusterArgs{
			Name: "example-cluster",
		}, nil)
		if err != nil {
			return err
		}
		read_only, err := digitalocean.LookupDatabaseReplica(ctx, &GetDatabaseReplicaArgs{
			ClusterId: example.Id,
			Name:      "terra-test-ro",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("replicaOutput", read_only.Uri)
		return nil
	})
}
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.GetDatabaseReplicaArgs;
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 = DigitaloceanFunctions.getDatabaseCluster(GetDatabaseClusterArgs.builder()
            .name("example-cluster")
            .build());

        final var read-only = DigitaloceanFunctions.getDatabaseReplica(GetDatabaseReplicaArgs.builder()
            .clusterId(example.applyValue(getDatabaseClusterResult -> getDatabaseClusterResult.id()))
            .name("terra-test-ro")
            .build());

        ctx.export("replicaOutput", read_only.uri());
    }
}
import pulumi
import pulumi_digitalocean as digitalocean

example = digitalocean.get_database_cluster(name="example-cluster")
read_only = digitalocean.get_database_replica(cluster_id=example.id,
    name="terra-test-ro")
pulumi.export("replicaOutput", read_only.uri)
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";

const example = digitalocean.getDatabaseCluster({
    name: "example-cluster",
});
const read-only = example.then(example => digitalocean.getDatabaseReplica({
    clusterId: example.id,
    name: "terra-test-ro",
}));
export const replicaOutput = read_only.then(read_only => read_only.uri);
variables:
  example:
    Fn::Invoke:
      Function: digitalocean:getDatabaseCluster
      Arguments:
        name: example-cluster
  read-only:
    Fn::Invoke:
      Function: digitalocean:getDatabaseReplica
      Arguments:
        clusterId: ${example.id}
        name: terra-test-ro
outputs:
  replicaOutput: ${["read-only"].uri}

Using getDatabaseReplica

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 getDatabaseReplica(args: GetDatabaseReplicaArgs, opts?: InvokeOptions): Promise<GetDatabaseReplicaResult>
function getDatabaseReplicaOutput(args: GetDatabaseReplicaOutputArgs, opts?: InvokeOptions): Output<GetDatabaseReplicaResult>
def get_database_replica(cluster_id: Optional[str] = None,
                         name: Optional[str] = None,
                         tags: Optional[Sequence[str]] = None,
                         opts: Optional[InvokeOptions] = None) -> GetDatabaseReplicaResult
def get_database_replica_output(cluster_id: Optional[pulumi.Input[str]] = None,
                         name: Optional[pulumi.Input[str]] = None,
                         tags: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                         opts: Optional[InvokeOptions] = None) -> Output[GetDatabaseReplicaResult]
func LookupDatabaseReplica(ctx *Context, args *LookupDatabaseReplicaArgs, opts ...InvokeOption) (*LookupDatabaseReplicaResult, error)
func LookupDatabaseReplicaOutput(ctx *Context, args *LookupDatabaseReplicaOutputArgs, opts ...InvokeOption) LookupDatabaseReplicaResultOutput

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

public static class GetDatabaseReplica 
{
    public static Task<GetDatabaseReplicaResult> InvokeAsync(GetDatabaseReplicaArgs args, InvokeOptions? opts = null)
    public static Output<GetDatabaseReplicaResult> Invoke(GetDatabaseReplicaInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetDatabaseReplicaResult> getDatabaseReplica(GetDatabaseReplicaArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: digitalocean:index/getDatabaseReplica:getDatabaseReplica
  Arguments:
    # Arguments dictionary

The following arguments are supported:

ClusterId string

The ID of the original source database cluster.

Name string

The name for the database replica.

Tags List<string>

A list of tag names to be applied to the database replica.

ClusterId string

The ID of the original source database cluster.

Name string

The name for the database replica.

Tags []string

A list of tag names to be applied to the database replica.

clusterId String

The ID of the original source database cluster.

name String

The name for the database replica.

tags List<String>

A list of tag names to be applied to the database replica.

clusterId string

The ID of the original source database cluster.

name string

The name for the database replica.

tags string[]

A list of tag names to be applied to the database replica.

cluster_id str

The ID of the original source database cluster.

name str

The name for the database replica.

tags Sequence[str]

A list of tag names to be applied to the database replica.

clusterId String

The ID of the original source database cluster.

name String

The name for the database replica.

tags List<String>

A list of tag names to be applied to the database replica.

getDatabaseReplica Result

The following output properties are available:

ClusterId string
Database string

Name of the replica's default database.

Host string

Database replica's hostname.

Id string

The provider-assigned unique ID for this managed resource.

Name string
Password string

Password for the replica's default user.

Port int

Network port that the database replica is listening on.

PrivateHost string

Same as host, but only accessible from resources within the account and in the same region.

PrivateNetworkUuid string
PrivateUri string

Same as uri, but only accessible from resources within the account and in the same region.

Region string
Uri string

The full URI for connecting to the database replica.

User string

Username for the replica's default user.

Tags List<string>

A list of tag names to be applied to the database replica.

ClusterId string
Database string

Name of the replica's default database.

Host string

Database replica's hostname.

Id string

The provider-assigned unique ID for this managed resource.

Name string
Password string

Password for the replica's default user.

Port int

Network port that the database replica is listening on.

PrivateHost string

Same as host, but only accessible from resources within the account and in the same region.

PrivateNetworkUuid string
PrivateUri string

Same as uri, but only accessible from resources within the account and in the same region.

Region string
Uri string

The full URI for connecting to the database replica.

User string

Username for the replica's default user.

Tags []string

A list of tag names to be applied to the database replica.

clusterId String
database String

Name of the replica's default database.

host String

Database replica's hostname.

id String

The provider-assigned unique ID for this managed resource.

name String
password String

Password for the replica's default user.

port Integer

Network port that the database replica is listening on.

privateHost String

Same as host, but only accessible from resources within the account and in the same region.

privateNetworkUuid String
privateUri String

Same as uri, but only accessible from resources within the account and in the same region.

region String
uri String

The full URI for connecting to the database replica.

user String

Username for the replica's default user.

tags List<String>

A list of tag names to be applied to the database replica.

clusterId string
database string

Name of the replica's default database.

host string

Database replica's hostname.

id string

The provider-assigned unique ID for this managed resource.

name string
password string

Password for the replica's default user.

port number

Network port that the database replica is listening on.

privateHost string

Same as host, but only accessible from resources within the account and in the same region.

privateNetworkUuid string
privateUri string

Same as uri, but only accessible from resources within the account and in the same region.

region string
uri string

The full URI for connecting to the database replica.

user string

Username for the replica's default user.

tags string[]

A list of tag names to be applied to the database replica.

cluster_id str
database str

Name of the replica's default database.

host str

Database replica's hostname.

id str

The provider-assigned unique ID for this managed resource.

name str
password str

Password for the replica's default user.

port int

Network port that the database replica is listening on.

private_host str

Same as host, but only accessible from resources within the account and in the same region.

private_network_uuid str
private_uri str

Same as uri, but only accessible from resources within the account and in the same region.

region str
uri str

The full URI for connecting to the database replica.

user str

Username for the replica's default user.

tags Sequence[str]

A list of tag names to be applied to the database replica.

clusterId String
database String

Name of the replica's default database.

host String

Database replica's hostname.

id String

The provider-assigned unique ID for this managed resource.

name String
password String

Password for the replica's default user.

port Number

Network port that the database replica is listening on.

privateHost String

Same as host, but only accessible from resources within the account and in the same region.

privateNetworkUuid String
privateUri String

Same as uri, but only accessible from resources within the account and in the same region.

region String
uri String

The full URI for connecting to the database replica.

user String

Username for the replica's default user.

tags List<String>

A list of tag names to be applied to the database replica.

Package Details

Repository
https://github.com/pulumi/pulumi-digitalocean
License
Apache-2.0
Notes

This Pulumi package is based on the digitalocean Terraform Provider.