Skip to content

Commit ce3a02f

Browse files
committed
update doc with examples
1 parent 3da17b5 commit ce3a02f

File tree

1 file changed

+60
-58
lines changed

1 file changed

+60
-58
lines changed

docs/resources/rdb_instance.md

Lines changed: 60 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,6 @@ resource "scaleway_rdb_instance" "main" {
2424
}
2525
```
2626

27-
### Example With IPAM
28-
29-
```hcl
30-
resource "scaleway_vpc_private_network" "pn" {}
31-
32-
resource "scaleway_rdb_instance" "main" {
33-
name = "test-rdb"
34-
node_type = "DB-DEV-S"
35-
engine = "PostgreSQL-11"
36-
is_ha_cluster = true
37-
disable_backup = true
38-
user_name = "my_initial_user"
39-
password = "thiZ_is_v&ry_s3cret"
40-
private_network {
41-
pn_id = scaleway_vpc_private_network.pn.id
42-
}
43-
}
44-
```
45-
4627
### Example with Settings
4728

4829
```hcl
@@ -79,38 +60,57 @@ resource "scaleway_rdb_instance" "main" {
7960
}
8061
```
8162

82-
### Example with custom private network
63+
### Examples of endpoints configuration
64+
65+
RDB Instances can have a maximum of 1 public endpoint and 1 private endpoint. It can have both, or none.
66+
67+
#### 1 static private network endpoint
8368

8469
```hcl
85-
# VPC PRIVATE NETWORK
8670
resource "scaleway_vpc_private_network" "pn" {
87-
name = "my_private_network"
8871
ipv4_subnet {
8972
subnet = "172.16.20.0/22"
9073
}
9174
}
9275
93-
# RDB INSTANCE CONNECTED ON A CUSTOM PRIVATE NETWORK
9476
resource "scaleway_rdb_instance" "main" {
95-
name = "test-rdb"
9677
node_type = "db-dev-s"
9778
engine = "PostgreSQL-11"
98-
is_ha_cluster = false
99-
disable_backup = true
100-
user_name = "my_initial_user"
101-
password = "thiZ_is_v&ry_s3cret"
102-
region = "fr-par"
103-
tags = ["terraform-test", "scaleway_rdb_instance", "volume", "rdb_pn"]
104-
volume_type = "bssd"
105-
volume_size_in_gb = 10
10679
private_network {
107-
ip_net = "172.16.20.4/22" # IP address within a given IP network
10880
pn_id = scaleway_vpc_private_network.pn.id
81+
ip_net = "172.16.20.4/22" # IP address within a given IP network
82+
(enable_ipam = false)
10983
}
110-
disable_public_endpoint = true
11184
}
11285
```
11386

87+
#### 1 IPAM private network endpoint + 1 public endpoint
88+
89+
```hcl
90+
resource "scaleway_vpc_private_network" "pn" {}
91+
92+
resource "scaleway_rdb_instance" "main" {
93+
node_type = "DB-DEV-S"
94+
engine = "PostgreSQL-11"
95+
private_network {
96+
pn_id = scaleway_vpc_private_network.pn.id
97+
(enable_ipam = true)
98+
}
99+
load_balancer {}
100+
}
101+
```
102+
103+
#### Default: 1 public endpoint
104+
105+
```hcl
106+
resource "scaleway_rdb_instance" "main" {
107+
node_type = "db-dev-s"
108+
engine = "PostgreSQL-11"
109+
}
110+
```
111+
112+
-> If nothing is defined, your instance will have a default public load-balancer endpoint
113+
114114
## Arguments Reference
115115

116116
The following arguments are supported:
@@ -145,6 +145,16 @@ and if you are using `bssd` storage, you should increase the volume size before
145145

146146
- `name` - (Optional) The name of the Database Instance.
147147

148+
- `tags` - (Optional) The tags associated with the Database Instance.
149+
150+
- `region` - (Defaults to [provider](../index.md#arguments-reference) `region`) The [region](../guides/regions_and_zones.md#regions)
151+
in which the Database Instance should be created.
152+
153+
- `project_id` - (Defaults to [provider](../index.md#arguments-reference) `project_id`) The ID of the project the Database
154+
Instance is associated with.
155+
156+
### Backups
157+
148158
- `disable_backup` - (Optional) Disable automated backup for the database instance.
149159

150160
- `backup_schedule_frequency` - (Optional) Backup schedule frequency in hours.
@@ -153,40 +163,32 @@ and if you are using `bssd` storage, you should increase the volume size before
153163

154164
- `backup_same_region` - (Optional) Boolean to store logical backups in the same region as the database instance.
155165

156-
- `init_settings` - (Optional) Map of engine settings to be set at database initialisation.
157-
158-
~> **Important:** Updates to `init_settings` will recreate the Database Instance.
166+
### Settings
159167

160168
- `settings` - (Optional) Map of engine settings to be set. Using this option will override default config.
161169

162-
- `tags` - (Optional) The tags associated with the Database Instance.
163-
164-
- `disable_public_endpoint` - (Optional) Disable the default public endpoint
165-
166-
- `region` - (Defaults to [provider](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#regions)
167-
in which the Database Instance should be created.
168-
169-
- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the project the Database
170-
Instance is associated with.
170+
- `init_settings` - (Optional) Map of engine settings to be set at database initialisation.
171171

172-
## Settings
172+
~> **Important:** Updates to `init_settings` will recreate the Database Instance.
173173

174-
Please consult
175-
the [GoDoc](https://pkg.go.dev/github.com/scaleway/[email protected]/api/rdb/v1#EngineVersion) to list all
176-
available `settings` and `init_settings` on your `node_type` of your convenient.
174+
Please consult the [GoDoc](https://pkg.go.dev/github.com/scaleway/[email protected]/api/rdb/v1#EngineVersion) to list all available `settings` and `init_settings` for the `node_type` of your convenience.
177175

178-
## Private Network
176+
### Endpoints
179177

180-
~> **Important:** Updates to `private_network` will recreate the attachment Instance.
178+
- `private_network` - List of private networks endpoints of the database instance.
181179

182-
~> **NOTE:** Please calculate your host IP.
183-
using [cirhost](https://developer.hashicorp.com/terraform/language/functions/cidrhost). Otherwise, lets IPAM service
180+
- `pn_id` - (Required) The ID of the private network.
181+
- `enable_ipam` - (Optional) Whether the endpoint should be configured with IPAM. Defaults to `false` if `ip_net` is defined, `true` otherwise.
182+
- `ip_net` - (Optional) The IP network address within the private subnet. This must be an IPv4 address with a CIDR notation.
183+
The IP network address within the private subnet is determined by the IP Address Management (IPAM) service if not set.
184+
185+
~> **NOTE:** Please calculate your host IP using [cidrhost](https://developer.hashicorp.com/terraform/language/functions/cidrhost). Otherwise, let IPAM service
184186
handle the host IP on the network.
185187

186-
- `ip_net` - (Optional) The IP network address within the private subnet. This must be an IPv4 address with a
187-
CIDR notation. The IP network address within the private subnet is determined by the IP Address Management (IPAM)
188-
service if not set.
189-
- `pn_id` - (Required) The ID of the private network.
188+
~> **Important:** Updates to `private_network` will recreate the Instance's endpoint
189+
190+
- `load_balancer` - (Optional) List of load balancer endpoints of the database instance. A load-balancer endpoint will be set by default if no private network is.
191+
This block must be defined if you want a public endpoint in addition to your private endpoint.
190192

191193
## Attributes Reference
192194

0 commit comments

Comments
 (0)