Skip to content

Commit

Permalink
Database: Clarify Docs for Referencing DB Replicas (#1045)
Browse files Browse the repository at this point in the history
* Database: Clarify Docs for Referencing DB Replicas

* reword

* add commit

---------

Co-authored-by: Andrew Starr-Bochicchio <[email protected]>
  • Loading branch information
danaelhe and andrewsomething authored Oct 12, 2023
1 parent 74bddda commit 5732de8
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
30 changes: 30 additions & 0 deletions docs/resources/database_firewall.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
24 changes: 24 additions & 0 deletions docs/resources/database_user.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 5732de8

Please sign in to comment.