Skip to content

Commit eef57ea

Browse files
committed
docs: aligning documentation regarding regional dataset value
1 parent 3bd793e commit eef57ea

File tree

3 files changed

+86
-176
lines changed

3 files changed

+86
-176
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
### Managing Dataset Size with the Regions Resource
2+
3+
For Active-Active databases, you can manage `dataset_size_in_gb` via either the `rediscloud_active_active_database` resource or the `rediscloud_active_active_subscription_regions` resource. Managing it via the regions resource allows you to update both database sizing and per-region throughput in a single operation.
4+
5+
~> **Critical:** The `dataset_size_in_gb` field is a global property that applies to all regional instances of this Active-Active database. You must choose **ONE** of the patterns below and use it consistently. **Never set different values in both resources** - this will cause Terraform to continuously revert changes between apply operations.
6+
7+
#### Option 1: Reference Pattern (Recommended)
8+
9+
Set `dataset_size_in_gb` on the regions resource and reference it from the database resource. This ensures a single source of truth and prevents conflicts:
10+
11+
```hcl
12+
resource "rediscloud_active_active_subscription_regions" "regions-resource" {
13+
subscription_id = rediscloud_active_active_subscription.subscription-resource.id
14+
dataset_size_in_gb = 10
15+
16+
region {
17+
region = "us-east-1"
18+
networking_deployment_cidr = "192.168.0.0/24"
19+
database {
20+
database_id = rediscloud_active_active_subscription_database.database-resource.db_id
21+
database_name = rediscloud_active_active_subscription_database.database-resource.name
22+
local_write_operations_per_second = 1000
23+
local_read_operations_per_second = 1000
24+
}
25+
}
26+
}
27+
28+
resource "rediscloud_active_active_subscription_database" "database-resource" {
29+
subscription_id = rediscloud_active_active_subscription.subscription-resource.id
30+
name = "database-name"
31+
# Reference the regions resource to avoid conflicts
32+
dataset_size_in_gb = rediscloud_active_active_subscription_regions.regions-resource.dataset_size_in_gb
33+
global_data_persistence = "aof-every-1-second"
34+
}
35+
```
36+
37+
#### Option 2: Explicit Dependency Pattern
38+
39+
Alternatively, set the value in both resources but use `depends_on` to ensure proper ordering:
40+
41+
```hcl
42+
resource "rediscloud_active_active_subscription_regions" "regions-resource" {
43+
subscription_id = rediscloud_active_active_subscription.subscription-resource.id
44+
dataset_size_in_gb = 10
45+
46+
region {
47+
region = "us-east-1"
48+
networking_deployment_cidr = "192.168.0.0/24"
49+
database {
50+
database_id = rediscloud_active_active_subscription_database.database-resource.db_id
51+
database_name = rediscloud_active_active_subscription_database.database-resource.name
52+
local_write_operations_per_second = 1000
53+
local_read_operations_per_second = 1000
54+
}
55+
}
56+
}
57+
58+
resource "rediscloud_active_active_subscription_database" "database-resource" {
59+
subscription_id = rediscloud_active_active_subscription.subscription-resource.id
60+
name = "database-name"
61+
dataset_size_in_gb = 10 # Must match the value in regions resource
62+
global_data_persistence = "aof-every-1-second"
63+
64+
# Ensure regions resource updates first
65+
depends_on = [rediscloud_active_active_subscription_regions.regions-resource]
66+
}
67+
```
68+
69+
-> **Note:** Option 1 (reference pattern) is recommended as it eliminates the risk of setting different values and provides clearer intent.
70+
71+
#### Option 3: Database Resource Only
72+
73+
If you don't need to coordinate dataset size changes with per-region throughput updates, you can manage `dataset_size_in_gb` solely on the database resource without using the regions resource:
74+
75+
```hcl
76+
resource "rediscloud_active_active_subscription_database" "database-resource" {
77+
subscription_id = rediscloud_active_active_subscription.subscription-resource.id
78+
name = "database-name"
79+
dataset_size_in_gb = 10
80+
global_data_persistence = "aof-every-1-second"
81+
}
82+
```

docs/resources/rediscloud_active_active_subscription_database.md

Lines changed: 1 addition & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -83,97 +83,14 @@ output "us-east-2-private-endpoints" {
8383
}
8484
```
8585

86-
### Managing Dataset Size with Regions Resource
87-
88-
For Active-Active databases, you can manage `dataset_size_in_gb` via either this database resource or the `rediscloud_active_active_subscription_regions` resource. Managing it via the regions resource allows you to update both database sizing and per-region throughput in a single operation.
89-
90-
~> **Critical:** The `dataset_size_in_gb` field is a **global property** that applies to **all databases** in the subscription. You must choose **ONE** of the patterns below and use it consistently. **Never set different values in both resources** - this will cause Terraform to continuously revert changes between apply operations.
91-
92-
#### Option 1: Reference Pattern (Recommended)
93-
94-
Set `dataset_size_in_gb` on the regions resource and reference it from the database resource. This ensures a single source of truth and prevents conflicts:
95-
96-
```hcl
97-
resource "rediscloud_active_active_subscription_regions" "regions-resource" {
98-
subscription_id = rediscloud_active_active_subscription.subscription-resource.id
99-
dataset_size_in_gb = 10
100-
101-
region {
102-
region = "us-east-1"
103-
networking_deployment_cidr = "192.168.0.0/24"
104-
database {
105-
database_id = rediscloud_active_active_subscription_database.database-resource.db_id
106-
database_name = rediscloud_active_active_subscription_database.database-resource.name
107-
local_write_operations_per_second = 1000
108-
local_read_operations_per_second = 1000
109-
}
110-
}
111-
}
112-
113-
resource "rediscloud_active_active_subscription_database" "database-resource" {
114-
subscription_id = rediscloud_active_active_subscription.subscription-resource.id
115-
name = "database-name"
116-
# Reference the regions resource to avoid conflicts
117-
dataset_size_in_gb = rediscloud_active_active_subscription_regions.regions-resource.dataset_size_in_gb
118-
global_data_persistence = "aof-every-1-second"
119-
}
120-
```
121-
122-
#### Option 2: Explicit Dependency Pattern
123-
124-
Alternatively, set the value in both resources but use `depends_on` to ensure proper ordering:
125-
126-
```hcl
127-
resource "rediscloud_active_active_subscription_regions" "regions-resource" {
128-
subscription_id = rediscloud_active_active_subscription.subscription-resource.id
129-
dataset_size_in_gb = 10
130-
131-
region {
132-
region = "us-east-1"
133-
networking_deployment_cidr = "192.168.0.0/24"
134-
database {
135-
database_id = rediscloud_active_active_subscription_database.database-resource.db_id
136-
database_name = rediscloud_active_active_subscription_database.database-resource.name
137-
local_write_operations_per_second = 1000
138-
local_read_operations_per_second = 1000
139-
}
140-
}
141-
}
142-
143-
resource "rediscloud_active_active_subscription_database" "database-resource" {
144-
subscription_id = rediscloud_active_active_subscription.subscription-resource.id
145-
name = "database-name"
146-
dataset_size_in_gb = 10 # Must match the value in regions resource
147-
global_data_persistence = "aof-every-1-second"
148-
149-
# Ensure regions resource updates first
150-
depends_on = [rediscloud_active_active_subscription_regions.regions-resource]
151-
}
152-
```
153-
154-
-> **Note:** Option 1 (reference pattern) is recommended as it eliminates the risk of setting different values and provides clearer intent.
155-
156-
#### Option 3: Database Resource Only
157-
158-
If you don't need to coordinate dataset size changes with per-region throughput updates, you can manage `dataset_size_in_gb` solely on the database resource without using the regions resource:
159-
160-
```hcl
161-
resource "rediscloud_active_active_subscription_database" "database-resource" {
162-
subscription_id = rediscloud_active_active_subscription.subscription-resource.id
163-
name = "database-name"
164-
dataset_size_in_gb = 10
165-
global_data_persistence = "aof-every-1-second"
166-
}
167-
```
168-
16986
## Argument Reference
17087

17188
The following arguments are supported:
17289
* `subscription_id`: (Required) The ID of the Active-Active subscription to create the database in. **Modifying this attribute will force creation of a new resource.**
17390
* `name` - (Required) A meaningful name to identify the database. **Modifying this attribute will force creation of a new resource.**
17491
* `redis_version` - (Optional) The Redis version of the database. If omitted, the Redis version will be the default. **Modifying this attribute will force creation of a new resource.**
17592
* `memory_limit_in_gb` - (Optional - **Required if `dataset_size_in_gb` is unset**) Maximum memory usage for this specific database, including replication and other overhead **Deprecated in favour of `dataset_size_in_gb` - not possible to import databases with this attribute set**
176-
* `dataset_size_in_gb` - (Optional - **Required if `memory_limit_in_gb` is unset**) The maximum amount of data in the dataset for this specific database is in GB. Can also be managed via the `rediscloud_active_active_subscription_regions` resource. To avoid conflicts when using both resources, either reference the regions value or use `depends_on` to ensure proper ordering.
93+
* `dataset_size_in_gb` - (Optional - **Required if `memory_limit_in_gb` is unset**) The maximum amount of data in the dataset for this specific database is in GB. Can also be managed via the `rediscloud_active_active_subscription_regions` resource. To avoid conflicts when using both resources, you must either reference the regions value or use `depends_on` to ensure proper ordering. Do not set different values in both resources. Refer to [this guide](../guides/managing-regional-datasets.md) for more information.
17794
* `support_oss_cluster_api` - (Optional) Support Redis open-source (OSS) Cluster API. Default: ‘false’
17895
* `external_endpoint_for_oss_cluster_api` - (Optional) Should use the external endpoint for open-source (OSS) Cluster API.
17996
Can only be enabled if OSS Cluster API support is enabled. Default: 'false'

docs/resources/rediscloud_active_active_subscription_regions.md

Lines changed: 3 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -46,105 +46,16 @@ resource "rediscloud_active_active_subscription_regions" "regions-resource" {
4646

4747
The `dataset_size_in_gb` field can be set on either the `rediscloud_active_active_subscription_regions` resource or the `rediscloud_active_active_subscription_database` resource. Setting it on the regions resource allows you to update both database sizing and per-region throughput in a single operation.
4848

49-
~> **Critical:** The `dataset_size_in_gb` field is a **global property** that applies to **all databases** in the subscription. You must choose **ONE** of the patterns below and use it consistently. **Never set different values in both resources** - this will cause Terraform to continuously revert changes between apply operations.
50-
51-
#### Option 1: Reference Pattern (Recommended)
52-
53-
Set `dataset_size_in_gb` on the regions resource and reference it from the database resource. This ensures a single source of truth:
54-
55-
```hcl
56-
resource "rediscloud_active_active_subscription_regions" "regions-resource" {
57-
subscription_id = rediscloud_active_active_subscription.subscription-resource.id
58-
delete_regions = false
59-
dataset_size_in_gb = 10
60-
region {
61-
region = "us-east-1"
62-
networking_deployment_cidr = "192.168.0.0/24"
63-
database {
64-
database_id = rediscloud_active_active_subscription_database.database-resource.db_id
65-
database_name = rediscloud_active_active_subscription_database.database-resource.name
66-
local_write_operations_per_second = 1000
67-
local_read_operations_per_second = 1000
68-
}
69-
}
70-
region {
71-
region = "us-east-2"
72-
networking_deployment_cidr = "10.0.1.0/24"
73-
local_resp_version = "resp2"
74-
database {
75-
database_id = rediscloud_active_active_subscription_database.database-resource.db_id
76-
database_name = rediscloud_active_active_subscription_database.database-resource.name
77-
local_write_operations_per_second = 2000
78-
local_read_operations_per_second = 4000
79-
}
80-
}
81-
}
82-
83-
resource "rediscloud_active_active_subscription_database" "database-resource" {
84-
subscription_id = rediscloud_active_active_subscription.subscription-resource.id
85-
name = "database-name"
86-
# Reference the regions resource to avoid conflicts
87-
dataset_size_in_gb = rediscloud_active_active_subscription_regions.regions-resource.dataset_size_in_gb
88-
global_data_persistence = "aof-every-1-second"
89-
90-
override_region {
91-
name = "us-east-2"
92-
override_global_source_ips = ["192.10.0.0/16"]
93-
}
94-
95-
override_region {
96-
name = "us-east-1"
97-
override_global_data_persistence = "none"
98-
override_global_password = "region-specific-password"
99-
override_global_alert {
100-
name = "dataset-size"
101-
value = 60
102-
}
103-
}
104-
}
105-
```
106-
107-
#### Option 2: Explicit Dependency Pattern
108-
109-
Alternatively, set the value in both resources but use `depends_on` to ensure the regions resource is updated first:
110-
111-
```hcl
112-
resource "rediscloud_active_active_subscription_regions" "regions-resource" {
113-
subscription_id = rediscloud_active_active_subscription.subscription-resource.id
114-
delete_regions = false
115-
dataset_size_in_gb = 10
116-
region {
117-
region = "us-east-1"
118-
networking_deployment_cidr = "192.168.0.0/24"
119-
database {
120-
database_id = rediscloud_active_active_subscription_database.database-resource.db_id
121-
database_name = rediscloud_active_active_subscription_database.database-resource.name
122-
local_write_operations_per_second = 1000
123-
local_read_operations_per_second = 1000
124-
}
125-
}
126-
}
127-
128-
resource "rediscloud_active_active_subscription_database" "database-resource" {
129-
subscription_id = rediscloud_active_active_subscription.subscription-resource.id
130-
name = "database-name"
131-
dataset_size_in_gb = 10 # Must match the value in regions resource
132-
global_data_persistence = "aof-every-1-second"
133-
134-
# Ensure regions resource updates first
135-
depends_on = [rediscloud_active_active_subscription_regions.regions-resource]
136-
}
137-
```
138-
139-
-> **Note:** Option 1 (reference pattern) is recommended as it eliminates the risk of setting different values and provides clearer intent.
49+
Refer to [this guide](../guides/managing-regional-datasets.md) for more information.
14050

14151
## Argument Reference
14252

14353
The following arguments are supported:
14454

14555
* `subscription_id` - (Required) ID of the subscription that the regions belong to. **Modifying this attribute will force creation of a new resource.**
14656
* `delete_regions` - (Optional) Flag required to be set when one or more regions is to be deleted, if the flag is not set an error will be thrown
147-
* `dataset_size_in_gb` - (Optional) Maximum amount of data in the dataset for all databases in this subscription in GB. This is a global property that updates all databases. To avoid conflicts, either reference this value from the database resource or use depends_on to ensure proper ordering. Do not set different values in both resources.
57+
* `dataset_size_in_gb` - (Optional) Maximum amount of data in the dataset for all regions in GB. Can also be managed via the `rediscloud_active_active_database` resource. To avoid conflicts, either reference this value from the database resource or use depends_on to ensure proper ordering. Do not set different values in both resources. Refer to [this guide](../guides/managing-regional-datasets.md) for more information.
58+
14859
* `region` - (Required) Cloud networking details, per region, documented below
14960

15061
The `region` block supports:

0 commit comments

Comments
 (0)