DigitalOcean v4.35.0 published on Tuesday, Nov 19, 2024 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)
// Output-based functions aren't available in Java yet
fn::invoke:
function: digitalocean:index/getDatabaseReplica:getDatabaseReplica
arguments:
# arguments dictionary
The 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:
- Cluster
Id 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.
- Private
Host string - Same as
host
, but only accessible from resources within the account and in the same region. - Private
Network stringUuid - Private
Uri string - Same as
uri
, but only accessible from resources within the account and in the same region. - Region string
- Storage
Size 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.
- Cluster
Id 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.
- Private
Host string - Same as
host
, but only accessible from resources within the account and in the same region. - Private
Network stringUuid - Private
Uri string - Same as
uri
, but only accessible from resources within the account and in the same region. - Region string
- Storage
Size 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 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.
- private
Host String - Same as
host
, but only accessible from resources within the account and in the same region. - private
Network StringUuid - private
Uri String - Same as
uri
, but only accessible from resources within the account and in the same region. - region String
- storage
Size 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.
- cluster
Id 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.
- private
Host string - Same as
host
, but only accessible from resources within the account and in the same region. - private
Network stringUuid - private
Uri string - Same as
uri
, but only accessible from resources within the account and in the same region. - region string
- storage
Size 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.
- cluster
Id 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.
- private
Host String - Same as
host
, but only accessible from resources within the account and in the same region. - private
Network StringUuid - private
Uri String - Same as
uri
, but only accessible from resources within the account and in the same region. - region String
- storage
Size 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
digitalocean
Terraform Provider.