DatabaseReplica

class DatabaseReplica : KotlinCustomResource

Provides a DigitalOcean database replica resource.

Example Usage

Create a new PostgreSQL database replica

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 com.pulumi.digitalocean.DatabaseFirewall;
import com.pulumi.digitalocean.DatabaseFirewallArgs;
import com.pulumi.digitalocean.inputs.DatabaseFirewallRuleArgs;
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 replica_example = new DatabaseReplica("replica-example", DatabaseReplicaArgs.builder()
.clusterId(postgres_example.id())
.size("db-s-1vcpu-1gb")
.region("nyc1")
.build());
ctx.export("uUID", replica_example.uuid());
var example_fw = new DatabaseFirewall("example-fw", DatabaseFirewallArgs.builder()
.clusterId(replica_example.uuid())
.rules(DatabaseFirewallRuleArgs.builder()
.type("ip_addr")
.value("192.168.1.1")
.build())
.build());
}
}

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

Properties

Link copied to clipboard
val clusterId: Output<String>

The ID of the original source database cluster.

Link copied to clipboard
val database: Output<String>

Name of the replica's default database.

Link copied to clipboard
val host: Output<String>

Database replica's hostname.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val name: Output<String>

The name for the database replica.

Link copied to clipboard
val password: Output<String>

Password for the replica's default user.

Link copied to clipboard
val port: Output<Int>

Network port that the database replica is listening on.

Link copied to clipboard
val privateHost: Output<String>

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

Link copied to clipboard

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

Link copied to clipboard
val privateUri: Output<String>

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

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val region: Output<String>?

DigitalOcean region where the replica will reside.

Link copied to clipboard
val size: Output<String>?

Database Droplet size associated with the replica (ex. db-s-1vcpu-1gb). Note that when resizing an existing replica, its size can only be increased. Decreasing its size is not supported.

Link copied to clipboard
val tags: Output<List<String>>?

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

Link copied to clipboard
val uri: Output<String>

The full URI for connecting to the database replica.

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard
val user: Output<String>

Username for the replica's default user.

Link copied to clipboard
val uuid: Output<String>

The UUID of the database replica. The uuid can be used to reference the database replica as the target database cluster in other resources. See example "Create firewall rule for database replica" above.