DigitalOcean

v4.16.0 published on Wednesday, Sep 28, 2022 by Pulumi

DatabaseReplica

Provides a DigitalOcean database replica resource.

Example Usage

Create a new PostgreSQL database replica

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

return await Deployment.RunAsync(() => 
{
    var postgres_example = new DigitalOcean.DatabaseCluster("postgres-example", new()
    {
        Engine = "pg",
        Version = "11",
        Size = "db-s-1vcpu-1gb",
        Region = "nyc1",
        NodeCount = 1,
    });

    var read_replica = new DigitalOcean.DatabaseReplica("read-replica", new()
    {
        ClusterId = postgres_example.Id,
        Size = "db-s-1vcpu-1gb",
        Region = "nyc1",
    });

});
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 {
		_, err := digitalocean.NewDatabaseCluster(ctx, "postgres-example", &digitalocean.DatabaseClusterArgs{
			Engine:    pulumi.String("pg"),
			Version:   pulumi.String("11"),
			Size:      pulumi.String("db-s-1vcpu-1gb"),
			Region:    pulumi.String("nyc1"),
			NodeCount: pulumi.Int(1),
		})
		if err != nil {
			return err
		}
		_, err = digitalocean.NewDatabaseReplica(ctx, "read-replica", &digitalocean.DatabaseReplicaArgs{
			ClusterId: postgres_example.ID(),
			Size:      pulumi.String("db-s-1vcpu-1gb"),
			Region:    pulumi.String("nyc1"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.digitalocean.DatabaseCluster;
import com.pulumi.digitalocean.DatabaseClusterArgs;
import com.pulumi.digitalocean.DatabaseReplica;
import com.pulumi.digitalocean.DatabaseReplicaArgs;
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) {
        var postgres_example = new DatabaseCluster("postgres-example", DatabaseClusterArgs.builder()        
            .engine("pg")
            .version("11")
            .size("db-s-1vcpu-1gb")
            .region("nyc1")
            .nodeCount(1)
            .build());

        var read_replica = new DatabaseReplica("read-replica", DatabaseReplicaArgs.builder()        
            .clusterId(postgres_example.id())
            .size("db-s-1vcpu-1gb")
            .region("nyc1")
            .build());

    }
}
import pulumi
import pulumi_digitalocean as digitalocean

postgres_example = digitalocean.DatabaseCluster("postgres-example",
    engine="pg",
    version="11",
    size="db-s-1vcpu-1gb",
    region="nyc1",
    node_count=1)
read_replica = digitalocean.DatabaseReplica("read-replica",
    cluster_id=postgres_example.id,
    size="db-s-1vcpu-1gb",
    region="nyc1")
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";

const postgres_example = new digitalocean.DatabaseCluster("postgres-example", {
    engine: "pg",
    version: "11",
    size: "db-s-1vcpu-1gb",
    region: "nyc1",
    nodeCount: 1,
});
const read_replica = new digitalocean.DatabaseReplica("read-replica", {
    clusterId: postgres_example.id,
    size: "db-s-1vcpu-1gb",
    region: "nyc1",
});
resources:
  read-replica:
    type: digitalocean:DatabaseReplica
    properties:
      clusterId: ${["postgres-example"].id}
      size: db-s-1vcpu-1gb
      region: nyc1
  postgres-example:
    type: digitalocean:DatabaseCluster
    properties:
      engine: pg
      version: 11
      size: db-s-1vcpu-1gb
      region: nyc1
      nodeCount: 1

Create DatabaseReplica Resource

new DatabaseReplica(name: string, args: DatabaseReplicaArgs, opts?: CustomResourceOptions);
@overload
def DatabaseReplica(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    cluster_id: Optional[str] = None,
                    name: Optional[str] = None,
                    private_network_uuid: Optional[str] = None,
                    region: Optional[Union[str, Region]] = None,
                    size: Optional[Union[str, DatabaseSlug]] = None,
                    tags: Optional[Sequence[str]] = None)
@overload
def DatabaseReplica(resource_name: str,
                    args: DatabaseReplicaArgs,
                    opts: Optional[ResourceOptions] = None)
func NewDatabaseReplica(ctx *Context, name string, args DatabaseReplicaArgs, opts ...ResourceOption) (*DatabaseReplica, error)
public DatabaseReplica(string name, DatabaseReplicaArgs args, CustomResourceOptions? opts = null)
public DatabaseReplica(String name, DatabaseReplicaArgs args)
public DatabaseReplica(String name, DatabaseReplicaArgs args, CustomResourceOptions options)
type: digitalocean:DatabaseReplica
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args DatabaseReplicaArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args DatabaseReplicaArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args DatabaseReplicaArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args DatabaseReplicaArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args DatabaseReplicaArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

DatabaseReplica Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The DatabaseReplica resource accepts the following input properties:

ClusterId string

The ID of the original source database cluster.

Name string

The name for the database replica.

PrivateNetworkUuid string

The ID of the VPC where the database replica will be located.

Region string | Pulumi.DigitalOcean.Region

DigitalOcean region where the replica will reside.

Size string | Pulumi.DigitalOcean.DatabaseSlug

Database Droplet size associated with the replica (ex. db-s-1vcpu-1gb).

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.

PrivateNetworkUuid string

The ID of the VPC where the database replica will be located.

Region string | Region

DigitalOcean region where the replica will reside.

Size string | DatabaseSlug

Database Droplet size associated with the replica (ex. db-s-1vcpu-1gb).

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.

privateNetworkUuid String

The ID of the VPC where the database replica will be located.

region String | Region

DigitalOcean region where the replica will reside.

size String | DatabaseSlug

Database Droplet size associated with the replica (ex. db-s-1vcpu-1gb).

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.

privateNetworkUuid string

The ID of the VPC where the database replica will be located.

region string | Region

DigitalOcean region where the replica will reside.

size string | DatabaseSlug

Database Droplet size associated with the replica (ex. db-s-1vcpu-1gb).

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.

private_network_uuid str

The ID of the VPC where the database replica will be located.

region str | Region

DigitalOcean region where the replica will reside.

size str | DatabaseSlug

Database Droplet size associated with the replica (ex. db-s-1vcpu-1gb).

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.

privateNetworkUuid String

The ID of the VPC where the database replica will be located.

region String | "nyc1" | "nyc2" | "nyc3" | "sgp1" | "lon1" | "ams2" | "ams3" | "fra1" | "tor1" | "sfo1" | "sfo2" | "sfo3" | "blr1"

DigitalOcean region where the replica will reside.

size String | "db-s-1vcpu-1gb" | "db-s-1vcpu-2gb" | "db-s-2vcpu-4gb" | "db-s-4vcpu-8gb" | "db-s-6vcpu-16gb" | "db-s-8vcpu-32gb" | "db-s-16vcpu-64gb"

Database Droplet size associated with the replica (ex. db-s-1vcpu-1gb).

tags List<String>

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

Outputs

All input properties are implicitly available as output properties. Additionally, the DatabaseReplica resource produces the following output properties:

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.

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.

PrivateUri string

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

Uri string

The full URI for connecting to the database replica.

User string

Username for the replica's default user.

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.

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.

PrivateUri string

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

Uri string

The full URI for connecting to the database replica.

User string

Username for the replica's default user.

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.

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.

privateUri String

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

uri String

The full URI for connecting to the database replica.

user String

Username for the replica's default user.

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.

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.

privateUri string

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

uri string

The full URI for connecting to the database replica.

user string

Username for the replica's default user.

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.

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_uri str

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

uri str

The full URI for connecting to the database replica.

user str

Username for the replica's default user.

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.

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.

privateUri String

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

uri String

The full URI for connecting to the database replica.

user String

Username for the replica's default user.

Look up Existing DatabaseReplica Resource

Get an existing DatabaseReplica resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: DatabaseReplicaState, opts?: CustomResourceOptions): DatabaseReplica
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        cluster_id: Optional[str] = None,
        database: Optional[str] = None,
        host: Optional[str] = None,
        name: Optional[str] = None,
        password: Optional[str] = None,
        port: Optional[int] = None,
        private_host: Optional[str] = None,
        private_network_uuid: Optional[str] = None,
        private_uri: Optional[str] = None,
        region: Optional[Union[str, Region]] = None,
        size: Optional[Union[str, DatabaseSlug]] = None,
        tags: Optional[Sequence[str]] = None,
        uri: Optional[str] = None,
        user: Optional[str] = None) -> DatabaseReplica
func GetDatabaseReplica(ctx *Context, name string, id IDInput, state *DatabaseReplicaState, opts ...ResourceOption) (*DatabaseReplica, error)
public static DatabaseReplica Get(string name, Input<string> id, DatabaseReplicaState? state, CustomResourceOptions? opts = null)
public static DatabaseReplica get(String name, Output<String> id, DatabaseReplicaState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
ClusterId string

The ID of the original source database cluster.

Database string

Name of the replica's default database.

Host string

Database replica's hostname.

Name string

The name for the database replica.

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

The ID of the VPC where the database replica will be located.

PrivateUri string

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

Region string | Pulumi.DigitalOcean.Region

DigitalOcean region where the replica will reside.

Size string | Pulumi.DigitalOcean.DatabaseSlug

Database Droplet size associated with the replica (ex. db-s-1vcpu-1gb).

Tags List<string>

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

Uri string

The full URI for connecting to the database replica.

User string

Username for the replica's default user.

ClusterId string

The ID of the original source database cluster.

Database string

Name of the replica's default database.

Host string

Database replica's hostname.

Name string

The name for the database replica.

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

The ID of the VPC where the database replica will be located.

PrivateUri string

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

Region string | Region

DigitalOcean region where the replica will reside.

Size string | DatabaseSlug

Database Droplet size associated with the replica (ex. db-s-1vcpu-1gb).

Tags []string

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

Uri string

The full URI for connecting to the database replica.

User string

Username for the replica's default user.

clusterId String

The ID of the original source database cluster.

database String

Name of the replica's default database.

host String

Database replica's hostname.

name String

The name for the database replica.

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

The ID of the VPC where the database replica will be located.

privateUri String

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

region String | Region

DigitalOcean region where the replica will reside.

size String | DatabaseSlug

Database Droplet size associated with the replica (ex. db-s-1vcpu-1gb).

tags List<String>

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

uri String

The full URI for connecting to the database replica.

user String

Username for the replica's default user.

clusterId string

The ID of the original source database cluster.

database string

Name of the replica's default database.

host string

Database replica's hostname.

name string

The name for the database replica.

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

The ID of the VPC where the database replica will be located.

privateUri string

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

region string | Region

DigitalOcean region where the replica will reside.

size string | DatabaseSlug

Database Droplet size associated with the replica (ex. db-s-1vcpu-1gb).

tags string[]

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

uri string

The full URI for connecting to the database replica.

user string

Username for the replica's default user.

cluster_id str

The ID of the original source database cluster.

database str

Name of the replica's default database.

host str

Database replica's hostname.

name str

The name for the database replica.

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

The ID of the VPC where the database replica will be located.

private_uri str

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

region str | Region

DigitalOcean region where the replica will reside.

size str | DatabaseSlug

Database Droplet size associated with the replica (ex. db-s-1vcpu-1gb).

tags Sequence[str]

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

uri str

The full URI for connecting to the database replica.

user str

Username for the replica's default user.

clusterId String

The ID of the original source database cluster.

database String

Name of the replica's default database.

host String

Database replica's hostname.

name String

The name for the database replica.

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

The ID of the VPC where the database replica will be located.

privateUri String

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

region String | "nyc1" | "nyc2" | "nyc3" | "sgp1" | "lon1" | "ams2" | "ams3" | "fra1" | "tor1" | "sfo1" | "sfo2" | "sfo3" | "blr1"

DigitalOcean region where the replica will reside.

size String | "db-s-1vcpu-1gb" | "db-s-1vcpu-2gb" | "db-s-2vcpu-4gb" | "db-s-4vcpu-8gb" | "db-s-6vcpu-16gb" | "db-s-8vcpu-32gb" | "db-s-16vcpu-64gb"

Database Droplet size associated with the replica (ex. db-s-1vcpu-1gb).

tags List<String>

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

uri String

The full URI for connecting to the database replica.

user String

Username for the replica's default user.

Supporting Types

DatabaseSlug

DB_1VPCU1GB
db-s-1vcpu-1gb
DB_1VPCU2GB
db-s-1vcpu-2gb
DB_2VPCU4GB
db-s-2vcpu-4gb
DB_4VPCU8GB
db-s-4vcpu-8gb
DB_6VPCU16GB
db-s-6vcpu-16gb
DB_8VPCU32GB
db-s-8vcpu-32gb
DB_16VPCU64GB
db-s-16vcpu-64gb
DatabaseSlug_DB_1VPCU1GB
db-s-1vcpu-1gb
DatabaseSlug_DB_1VPCU2GB
db-s-1vcpu-2gb
DatabaseSlug_DB_2VPCU4GB
db-s-2vcpu-4gb
DatabaseSlug_DB_4VPCU8GB
db-s-4vcpu-8gb
DatabaseSlug_DB_6VPCU16GB
db-s-6vcpu-16gb
DatabaseSlug_DB_8VPCU32GB
db-s-8vcpu-32gb
DatabaseSlug_DB_16VPCU64GB
db-s-16vcpu-64gb
DB_1VPCU1GB
db-s-1vcpu-1gb
DB_1VPCU2GB
db-s-1vcpu-2gb
DB_2VPCU4GB
db-s-2vcpu-4gb
DB_4VPCU8GB
db-s-4vcpu-8gb
DB_6VPCU16GB
db-s-6vcpu-16gb
DB_8VPCU32GB
db-s-8vcpu-32gb
DB_16VPCU64GB
db-s-16vcpu-64gb
DB_1VPCU1GB
db-s-1vcpu-1gb
DB_1VPCU2GB
db-s-1vcpu-2gb
DB_2VPCU4GB
db-s-2vcpu-4gb
DB_4VPCU8GB
db-s-4vcpu-8gb
DB_6VPCU16GB
db-s-6vcpu-16gb
DB_8VPCU32GB
db-s-8vcpu-32gb
DB_16VPCU64GB
db-s-16vcpu-64gb
D_B_1_VPCU1_GB
db-s-1vcpu-1gb
D_B_1_VPCU2_GB
db-s-1vcpu-2gb
D_B_2_VPCU4_GB
db-s-2vcpu-4gb
D_B_4_VPCU8_GB
db-s-4vcpu-8gb
D_B_6_VPCU16_GB
db-s-6vcpu-16gb
D_B_8_VPCU32_GB
db-s-8vcpu-32gb
D_B_16_VPCU64_GB
db-s-16vcpu-64gb
"db-s-1vcpu-1gb"
db-s-1vcpu-1gb
"db-s-1vcpu-2gb"
db-s-1vcpu-2gb
"db-s-2vcpu-4gb"
db-s-2vcpu-4gb
"db-s-4vcpu-8gb"
db-s-4vcpu-8gb
"db-s-6vcpu-16gb"
db-s-6vcpu-16gb
"db-s-8vcpu-32gb"
db-s-8vcpu-32gb
"db-s-16vcpu-64gb"
db-s-16vcpu-64gb

Region

NYC1
nyc1
NYC2
nyc2
NYC3
nyc3
SGP1
sgp1
LON1
lon1
AMS2
ams2
AMS3
ams3
FRA1
fra1
TOR1
tor1
SFO1
sfo1
SFO2
sfo2
SFO3
sfo3
BLR1
blr1
RegionNYC1
nyc1
RegionNYC2
nyc2
RegionNYC3
nyc3
RegionSGP1
sgp1
RegionLON1
lon1
RegionAMS2
ams2
RegionAMS3
ams3
RegionFRA1
fra1
RegionTOR1
tor1
RegionSFO1
sfo1
RegionSFO2
sfo2
RegionSFO3
sfo3
RegionBLR1
blr1
NYC1
nyc1
NYC2
nyc2
NYC3
nyc3
SGP1
sgp1
LON1
lon1
AMS2
ams2
AMS3
ams3
FRA1
fra1
TOR1
tor1
SFO1
sfo1
SFO2
sfo2
SFO3
sfo3
BLR1
blr1
NYC1
nyc1
NYC2
nyc2
NYC3
nyc3
SGP1
sgp1
LON1
lon1
AMS2
ams2
AMS3
ams3
FRA1
fra1
TOR1
tor1
SFO1
sfo1
SFO2
sfo2
SFO3
sfo3
BLR1
blr1
NYC1
nyc1
NYC2
nyc2
NYC3
nyc3
SGP1
sgp1
LON1
lon1
AMS2
ams2
AMS3
ams3
FRA1
fra1
TOR1
tor1
SFO1
sfo1
SFO2
sfo2
SFO3
sfo3
BLR1
blr1
"nyc1"
nyc1
"nyc2"
nyc2
"nyc3"
nyc3
"sgp1"
sgp1
"lon1"
lon1
"ams2"
ams2
"ams3"
ams3
"fra1"
fra1
"tor1"
tor1
"sfo1"
sfo1
"sfo2"
sfo2
"sfo3"
sfo3
"blr1"
blr1

Import

Database replicas can be imported using the id of the source database cluster and the name of the replica joined with a comma. For example

 $ pulumi import digitalocean:index/databaseReplica:DatabaseReplica read-replica 245bcfd0-7f31-4ce6-a2bc-475a116cca97,read-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.