From 5732de829125884e24c53e405e405a347cc80a48 Mon Sep 17 00:00:00 2001 From: danaelhe <42972711+danaelhe@users.noreply.github.com> Date: Thu, 12 Oct 2023 15:12:36 -0400 Subject: [PATCH] Database: Clarify Docs for Referencing DB Replicas (#1045) * Database: Clarify Docs for Referencing DB Replicas * reword * add commit --------- Co-authored-by: Andrew Starr-Bochicchio --- docs/resources/database_firewall.md | 30 +++++++++++++++++++++++++++++ docs/resources/database_user.md | 24 +++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/docs/resources/database_firewall.md b/docs/resources/database_firewall.md index db3b903c8..2917186af 100644 --- a/docs/resources/database_firewall.md +++ b/docs/resources/database_firewall.md @@ -66,6 +66,36 @@ resource "digitalocean_database_cluster" "postgres-example" { } ``` +### Create a new database firewall for a database replica + +```hcl +resource "digitalocean_database_cluster" "postgres-example" { + name = "example-postgres-cluster" + engine = "pg" + version = "11" + size = "db-s-1vcpu-1gb" + region = "nyc1" + node_count = 1 +} + +resource "digitalocean_database_replica" "replica-example" { + cluster_id = digitalocean_database_cluster.postgres-example.id + name = "replica-example" + size = "db-s-1vcpu-1gb" + region = "nyc1" +} + +# Create firewall rule for database replica +resource "digitalocean_database_firewall" "example-fw" { + cluster_id = digitalocean_database_replica.replica-example.uuid + + rule { + type = "ip_addr" + value = "192.168.1.1" + } +} +``` + ## Argument Reference The following arguments are supported: diff --git a/docs/resources/database_user.md b/docs/resources/database_user.md index 57d95459e..e2db5719e 100644 --- a/docs/resources/database_user.md +++ b/docs/resources/database_user.md @@ -27,6 +27,30 @@ resource "digitalocean_database_cluster" "postgres-example" { } ``` +### Create a new user for a PostgreSQL database replica +```hcl +resource "digitalocean_database_cluster" "postgres-example" { + name = "example-postgres-cluster" + engine = "pg" + version = "11" + size = "db-s-1vcpu-1gb" + region = "nyc1" + node_count = 1 +} + +resource "digitalocean_database_replica" "replica-example" { + cluster_id = digitalocean_database_cluster.postgres-example.id + name = "replica-example" + size = "db-s-1vcpu-1gb" + region = "nyc1" +} + +resource "digitalocean_database_user" "user-example" { + cluster_id = digitalocean_database_replica.replica-example.uuid + name = "foobar" +} +``` + ## Argument Reference The following arguments are supported: