DigitalOcean v4.40.2 published on Wednesday, Mar 19, 2025 by Pulumi
digitalocean.getDatabaseReplica
Explore with Pulumi AI
Provides information on a DigitalOcean database replica.
Example Usage
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);
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)
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, &digitalocean.LookupDatabaseClusterArgs{
			Name: "example-cluster",
		}, nil)
		if err != nil {
			return err
		}
		read_only, err := digitalocean.LookupDatabaseReplica(ctx, &digitalocean.LookupDatabaseReplicaArgs{
			ClusterId: example.Id,
			Name:      "terra-test-ro",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("replicaOutput", read_only.Uri)
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
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(read_only => read_only.Apply(getDatabaseReplicaResult => getDatabaseReplicaResult.Uri)),
    };
});
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());
    }
}
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)
public static Output<GetDatabaseReplicaResult> getDatabaseReplica(GetDatabaseReplicaArgs args, InvokeOptions options)
fn::invoke:
  function: digitalocean:index/getDatabaseReplica:getDatabaseReplica
  arguments:
    # arguments dictionaryThe following arguments are supported:
- cluster_id str
- The ID of the original source database cluster.
- name str
- The name for the database replica.
- Sequence[str]
- 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.
- PrivateNetwork stringUuid 
- PrivateUri string
- Same as uri, but only accessible from resources within the account and in the same region.
- Region string
- StorageSize stringMib 
- Uri string
- The full URI for connecting to the database replica.
- User string
- Username for the replica's default user.
- Uuid string
- The UUID of the database replica.
- 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.
- PrivateNetwork stringUuid 
- PrivateUri string
- Same as uri, but only accessible from resources within the account and in the same region.
- Region string
- StorageSize stringMib 
- Uri string
- The full URI for connecting to the database replica.
- User string
- Username for the replica's default user.
- Uuid string
- The UUID of the database replica.
- []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.
- privateNetwork StringUuid 
- privateUri String
- Same as uri, but only accessible from resources within the account and in the same region.
- region String
- storageSize StringMib 
- uri String
- The full URI for connecting to the database replica.
- user String
- Username for the replica's default user.
- uuid String
- The UUID of the database replica.
- 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.
- privateNetwork stringUuid 
- privateUri string
- Same as uri, but only accessible from resources within the account and in the same region.
- region string
- storageSize stringMib 
- uri string
- The full URI for connecting to the database replica.
- user string
- Username for the replica's default user.
- uuid string
- The UUID of the database replica.
- 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_ struuid 
- private_uri str
- Same as uri, but only accessible from resources within the account and in the same region.
- region str
- storage_size_ strmib 
- uri str
- The full URI for connecting to the database replica.
- user str
- Username for the replica's default user.
- uuid str
- The UUID of the database replica.
- 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.
- privateNetwork StringUuid 
- privateUri String
- Same as uri, but only accessible from resources within the account and in the same region.
- region String
- storageSize StringMib 
- uri String
- The full URI for connecting to the database replica.
- user String
- Username for the replica's default user.
- uuid String
- The UUID of the database replica.
- List<String>
- A list of tag names to be applied to the database replica.
Package Details
- Repository
- DigitalOcean pulumi/pulumi-digitalocean
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the digitaloceanTerraform Provider.