@@ -53,7 +53,7 @@ resource "scaleway_rdb_instance" "main" {
53
53
engine = "MySQL-8"
54
54
user_name = "my_initial_user"
55
55
password = "thiZ_is_v&ry_s3cret"
56
- init_settings = {
56
+ init_settings = {
57
57
"lower_case_table_names" = 1
58
58
}
59
59
settings = {
@@ -79,44 +79,18 @@ resource "scaleway_rdb_instance" "main" {
79
79
}
80
80
```
81
81
82
- ### Example with private network and dhcp configuration
82
+ ### Example with custom private network
83
83
84
84
``` hcl
85
- resource "scaleway_vpc_private_network" "pn02" {
85
+ # VPC PRIVATE NETWORK
86
+ resource "scaleway_vpc_private_network" "pn" {
86
87
name = "my_private_network"
88
+ ipv4_subnet {
89
+ subnet = "172.16.20.0/22"
90
+ }
87
91
}
88
92
89
- resource "scaleway_vpc_public_gateway_dhcp" "main" {
90
- subnet = "192.168.1.0/24"
91
- }
92
-
93
- resource "scaleway_vpc_public_gateway_ip" "main" {
94
- }
95
-
96
- resource "scaleway_vpc_public_gateway" "main" {
97
- name = "foobar"
98
- type = "VPC-GW-S"
99
- ip_id = scaleway_vpc_public_gateway_ip.main.id
100
- }
101
-
102
- resource "scaleway_vpc_public_gateway_pat_rule" "main" {
103
- gateway_id = scaleway_vpc_public_gateway.main.id
104
- private_ip = scaleway_vpc_public_gateway_dhcp.main.address
105
- private_port = scaleway_rdb_instance.main.private_network.0.port
106
- public_port = 42
107
- protocol = "both"
108
- depends_on = [scaleway_vpc_gateway_network.main, scaleway_vpc_private_network.pn02]
109
- }
110
-
111
- resource "scaleway_vpc_gateway_network" "main" {
112
- gateway_id = scaleway_vpc_public_gateway.main.id
113
- private_network_id = scaleway_vpc_private_network.pn02.id
114
- dhcp_id = scaleway_vpc_public_gateway_dhcp.main.id
115
- cleanup_dhcp = true
116
- enable_masquerade = true
117
- depends_on = [scaleway_vpc_public_gateway_ip.main, scaleway_vpc_private_network.pn02]
118
- }
119
-
93
+ # RDB INSTANCE CONNECTED ON A CUSTOM PRIVATE NETWORK
120
94
resource "scaleway_rdb_instance" "main" {
121
95
name = "test-rdb"
122
96
node_type = "db-dev-s"
@@ -130,8 +104,8 @@ resource "scaleway_rdb_instance" "main" {
130
104
volume_type = "bssd"
131
105
volume_size_in_gb = 10
132
106
private_network {
133
- ip_net = "192.168.1.254/24 " #pool high
134
- pn_id = scaleway_vpc_private_network.pn02 .id
107
+ ip_net = "172.16.20.4/22 " # IP address within a given IP network
108
+ pn_id = scaleway_vpc_private_network.pn .id
135
109
}
136
110
}
137
111
```
@@ -197,6 +171,10 @@ available `settings` and `init_settings` on your `node_type` of your convenient.
197
171
198
172
~ > ** Important:** Updates to ` private_network ` will recreate the attachment Instance.
199
173
174
+ ~ > ** NOTE:** Please calculate your host IP.
175
+ using [ cirhost] ( https://developer.hashicorp.com/terraform/language/functions/cidrhost ) . Otherwise, lets IPAM service
176
+ handle the host IP on the network.
177
+
200
178
- ` ip_net ` - (Optional) The IP network address within the private subnet. This must be an IPv4 address with a
201
179
CIDR notation. The IP network address within the private subnet is determined by the IP Address Management (IPAM)
202
180
service if not set.
@@ -224,11 +202,11 @@ are of the form `{region}/{id}`, e.g. `fr-par/11111111-1111-1111-1111-1111111111
224
202
- ` name ` - Name of the endpoint.
225
203
- ` hostname ` - Name of the endpoint.
226
204
- ` private_network ` - List of private networks endpoints of the database instance.
227
- - ` endpoint_id ` - The ID of the endpoint of the private network .
228
- - ` ip ` - IP of the endpoint .
229
- - ` port ` - Port of the endpoint .
205
+ - ` endpoint_id ` - The ID of the endpoint.
206
+ - ` ip ` - IPv4 address on the network .
207
+ - ` port ` - Port in the Private Network .
230
208
- ` name ` - Name of the endpoint.
231
- - ` hostname ` - Name of the endpoint.
209
+ - ` hostname ` - Hostname of the endpoint.
232
210
- ` certificate ` - Certificate of the database instance.
233
211
- ` organization_id ` - The organization ID the Database Instance is associated with.
234
212
0 commit comments