Skip to content

Commit c4455c2

Browse files
authored
docs: improve rdb_acl documentation with multiple rules examples and conflict warnings (#3355)
1 parent 05b0477 commit c4455c2

File tree

2 files changed

+102
-0
lines changed

2 files changed

+102
-0
lines changed

docs/resources/rdb_acl.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,55 @@ resource "scaleway_rdb_acl" "main" {
3232
}
3333
```
3434

35+
### Multiple ACL Rules
36+
37+
```terraform
38+
resource "scaleway_rdb_acl" "main" {
39+
instance_id = scaleway_rdb_instance.main.id
40+
41+
acl_rules {
42+
ip = "1.2.3.4/32"
43+
description = "Office IP"
44+
}
45+
46+
acl_rules {
47+
ip = "5.6.7.8/32"
48+
description = "Home IP"
49+
}
50+
51+
acl_rules {
52+
ip = "10.0.0.0/24"
53+
description = "Internal network"
54+
}
55+
}
56+
```
57+
58+
### Dynamic ACL Rules with Variables
59+
60+
```terraform
61+
variable "allowed_ips" {
62+
description = "Map of allowed IPs with descriptions"
63+
type = map(string)
64+
default = {
65+
"1.2.3.4/32" = "Office IP"
66+
"5.6.7.8/32" = "Home IP"
67+
"10.0.0.0/24" = "Internal network"
68+
}
69+
}
70+
71+
resource "scaleway_rdb_acl" "main" {
72+
instance_id = scaleway_rdb_instance.main.id
73+
74+
dynamic "acl_rules" {
75+
for_each = var.allowed_ips
76+
content {
77+
ip = acl_rules.key
78+
description = acl_rules.value
79+
}
80+
}
81+
}
82+
```
83+
3584
## Argument Reference
3685

3786
The following arguments are supported:
@@ -42,6 +91,8 @@ The following arguments are supported:
4291

4392
- `acl_rules` - A list of ACLs (structure is described below)
4493

94+
~> **Important:** The `scaleway_rdb_acl` resource replaces **all** ACL rules for the given instance. Multiple `scaleway_rdb_acl` resources targeting the same `instance_id` will conflict with each other. Use multiple `acl_rules` blocks within a single resource instead.
95+
4596
- `region` - (Defaults to [provider](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#regions) in which the Database Instance should be created.
4697

4798
The `acl_rules` block supports:

templates/resources/rdb_acl.md.tmpl

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,55 @@ resource "scaleway_rdb_acl" "main" {
3232
}
3333
```
3434

35+
### Multiple ACL Rules
36+
37+
```terraform
38+
resource "scaleway_rdb_acl" "main" {
39+
instance_id = scaleway_rdb_instance.main.id
40+
41+
acl_rules {
42+
ip = "1.2.3.4/32"
43+
description = "Office IP"
44+
}
45+
46+
acl_rules {
47+
ip = "5.6.7.8/32"
48+
description = "Home IP"
49+
}
50+
51+
acl_rules {
52+
ip = "10.0.0.0/24"
53+
description = "Internal network"
54+
}
55+
}
56+
```
57+
58+
### Dynamic ACL Rules with Variables
59+
60+
```terraform
61+
variable "allowed_ips" {
62+
description = "Map of allowed IPs with descriptions"
63+
type = map(string)
64+
default = {
65+
"1.2.3.4/32" = "Office IP"
66+
"5.6.7.8/32" = "Home IP"
67+
"10.0.0.0/24" = "Internal network"
68+
}
69+
}
70+
71+
resource "scaleway_rdb_acl" "main" {
72+
instance_id = scaleway_rdb_instance.main.id
73+
74+
dynamic "acl_rules" {
75+
for_each = var.allowed_ips
76+
content {
77+
ip = acl_rules.key
78+
description = acl_rules.value
79+
}
80+
}
81+
}
82+
```
83+
3584
## Argument Reference
3685

3786
The following arguments are supported:
@@ -42,6 +91,8 @@ The following arguments are supported:
4291

4392
- `acl_rules` - A list of ACLs (structure is described below)
4493

94+
~> **Important:** The `scaleway_rdb_acl` resource replaces **all** ACL rules for the given instance. Multiple `scaleway_rdb_acl` resources targeting the same `instance_id` will conflict with each other. Use multiple `acl_rules` blocks within a single resource instead.
95+
4596
- `region` - (Defaults to [provider](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#regions) in which the Database Instance should be created.
4697

4798
The `acl_rules` block supports:

0 commit comments

Comments
 (0)