Skip to content

Commit 2fc3d1f

Browse files
authored
Merge pull request #573 from RedisLabs/remove-status-from-db-resources
Remove latest_backup_status and latest_import_status from resources
2 parents 6a4f34a + 23f4abc commit 2fc3d1f

15 files changed

+184
-651
lines changed

CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@
33
All notable changes to this project will be documented in this file.
44
See updating [Changelog example here](https://keepachangelog.com/en/1.0.0/)
55

6+
# 2.0.0 (Unreleased)
7+
8+
### Changed
9+
10+
- Upgraded the provider to use `v0.21.0` of the [rediscloud-go-api](https://github.com/RedisLabs/rediscloud-go-api) which handles API rate limits gracefully.
11+
12+
### Removed
13+
14+
- `latest_backup_status` and `latest_import_status` from `rediscloud_active_active_subscription_database`,
15+
`rediscloud_active_active_subscription_regions`, `rediscloud_subscription_database` and `rediscloud_essentials_database`.
16+
Users should use the equivalent data sources instead.
17+
618
# 1.9.0 (9th Oct 2024)
719

820
### Added

docs/data-sources/rediscloud_active_active_subscription_database.md

+9-3
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,17 @@ data "rediscloud_active_active_subscription_database" "example" {
5151
* `global_modules` - A list of modules to be enabled on all deployments of this database.
5252
* `public_endpoint` - Public endpoint to access the database.
5353
* `private_endpoint` - Private endpoint to access the database.
54-
* `latest_backup_statuses` A list of latest_backup_status objects, documented below.
55-
* `latest_import_status` - A latest_import_status object, documented below.`
54+
* `latest_backup_statuses` A list of `latest_backup_status` objects, documented below.
55+
* `latest_import_status` - A `latest_import_status` object, documented below.`
5656
* `tags` - A string/string map of all Tags associated with this database.
5757

58-
The `latest_backup_status` object and `latest_import_status` block contains:
58+
The `latest_backup_status` block contains:
59+
60+
* `region` - The region within the Cloud Provider where this database is hosted.
61+
* `error` - An error block, in case this lookup failed, documented below.
62+
* `response` - A detail block, documented below.
63+
64+
The `latest_import_status` block contains:
5965

6066
* `error` - An error block, in case this lookup failed, documented below.
6167
* `response` - A detail block, documented below.

docs/guides/migration-guide-v2.0.0.md

+152
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
---
2+
page_title: "Migrating to version v2.X.X"
3+
---
4+
5+
# Migrating to version v2.X.X
6+
7+
V2 introduced breaking changes with the removal the `latest_backup_status` and `latest_import_status` attributes from `rediscloud_active_active_subscription_database`,
8+
`rediscloud_active_active_subscription_regions`, `rediscloud_subscription_database` and `rediscloud_essentials_database` resources.
9+
With this change, plans will be much faster to compute and apply. If you rely on one those attributes, they are still available under the respective database data sources.
10+
See the examples below on how to migrate to use the data sources.
11+
12+
## Active-Active Subscription Database:
13+
14+
**Before:**
15+
```hcl
16+
17+
resource "rediscloud_active_active_subscription_database" "database_resource" {
18+
# ...
19+
}
20+
21+
output "latest_backup_status" {
22+
value = nonsensitive({
23+
for r in rediscloud_active_active_subscription_database.database_resource.override_region :
24+
r.name => r.latest_backup_status
25+
})
26+
}
27+
28+
output "latest_import_status" {
29+
value = rediscloud_active_active_subscription_database.database_resource.latest_import_status
30+
}
31+
```
32+
33+
**After:**
34+
35+
```hcl
36+
data "rediscloud_active_active_subscription_database" "database" {
37+
subscription_id = "..."
38+
name = "..."
39+
}
40+
41+
output "latest_backup_status" {
42+
value = {
43+
for r in data.rediscloud_active_active_subscription_database.database.latest_backup_statuses :
44+
r.region => r
45+
}
46+
}
47+
48+
output "latest_import_status" {
49+
value = data.rediscloud_active_active_subscription_database.database.latest_import_status
50+
}
51+
```
52+
53+
## Active-Active Subscription Regions:
54+
55+
**Before:**
56+
```hcl
57+
resource "rediscloud_active_active_subscription_regions" "regions_resource" {
58+
# ...
59+
}
60+
61+
output "latest_backup_status" {
62+
value = {
63+
for r in rediscloud_active_active_subscription_regions.regions_resource.region :
64+
r.region => r.database[*].latest_backup_status)
65+
}
66+
}
67+
```
68+
69+
**After:**
70+
71+
```hcl
72+
data "rediscloud_active_active_subscription_database" "database" {
73+
subscription_id = "..."
74+
name = "..."
75+
}
76+
77+
output "latest_backup_status" {
78+
value = {
79+
for r in data.rediscloud_active_active_subscription_database.database.latest_backup_statuses :
80+
r.region => flatten(r.response[*].status)
81+
}
82+
}
83+
```
84+
85+
## Pro Subscriptions:
86+
87+
**Before:**
88+
```hcl
89+
resource "rediscloud_subscription_database" "database_resource" {
90+
# ...
91+
}
92+
93+
output "latest_backup_status" {
94+
value = rediscloud_subscription_database.database_resource.latest_backup_status
95+
}
96+
97+
output "latest_import_status" {
98+
value = rediscloud_subscription_database.database_resource.latest_import_status
99+
}
100+
```
101+
102+
**After:**
103+
104+
```hcl
105+
data "rediscloud_database" "database" {
106+
subscription_id = "..."
107+
name = "..."
108+
}
109+
110+
output "latest_backup_status" {
111+
value = data.rediscloud_database.database.latest_backup_status
112+
}
113+
114+
output "latest_import_status" {
115+
value = data.rediscloud_database.database.latest_import_status
116+
}
117+
```
118+
119+
## Essentials Subscriptions:
120+
121+
**Before:**
122+
```hcl
123+
resource "rediscloud_essentials_database" "database_resource" {
124+
# ...
125+
}
126+
127+
output "latest_backup_status" {
128+
value = rediscloud_essentials_database.database_resource.latest_backup_status
129+
}
130+
131+
output "latest_import_status" {
132+
value = rediscloud_essentials_database.database_resource.latest_import_status
133+
}
134+
```
135+
136+
**After:**
137+
138+
```hcl
139+
data "rediscloud_essentials_database" "database" {
140+
subscription_id = "..."
141+
name = "..."
142+
}
143+
144+
output "latest_backup_status" {
145+
value = data.rediscloud_essentials_database.database.latest_backup_status
146+
}
147+
148+
output "latest_import_status" {
149+
value = data.rediscloud_essentials_database.database.latest_import_status
150+
}
151+
```
152+

docs/resources/rediscloud_active_active_subscription_database.md

-26
Original file line numberDiff line numberDiff line change
@@ -143,32 +143,6 @@ The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/l
143143
* `db_id` - Identifier of the database created
144144
* `public_endpoint` - A map of which public endpoints can to access the database per region, uses region name as key.
145145
* `private_endpoint` - A map of which private endpoints can to access the database per region, uses region name as key.
146-
* `override_region.latest_backup_status` - On each override_region block, the latest_backup_status is reported, an object documented below.
147-
* `latest_import_status` - A latest_import_status object, documented below.
148-
149-
The `latest_backup_status` object and `latest_import_status` block contains:
150-
151-
* `error` - An error block, in case this lookup failed, documented below.
152-
* `response` - A detail block, documented below.
153-
154-
The `error` block in `latest_backup_status` and `latest_import_status` contains:
155-
156-
* `type` - The type of error encountered while looking up the status of the last import.
157-
* `description` - A description of the error encountered while looking up the status of the last import.
158-
* `status` - Any particular HTTP status code associated with the erroneous status check.
159-
160-
The `response` block `latest_backup_status` contains:
161-
162-
* `status` - The status of the last backup operation.
163-
* `last_backup_time` - When the last backup operation occurred.
164-
* `failure_reason` - If a failure, why the backup operation failed.
165-
166-
The `response` block `latest_import_status` contains:
167-
168-
* `status` - The status of the last import operation.
169-
* `last_import_time` - When the last import operation occurred.
170-
* `failure_reason` - If a failure, why the import operation failed.
171-
* `failure_reason_params` - Parameters of the failure, if appropriate, in the form of a list of objects each with a `key` entry and a `value` entry.
172146

173147
## Import
174148
`rediscloud_active_active_subscription_database` can be imported using the ID of the Active-Active subscription and the ID of the database in the format {subscription ID}/{database ID}, e.g.

docs/resources/rediscloud_active_active_subscription_regions.md

-21
Original file line numberDiff line numberDiff line change
@@ -66,27 +66,6 @@ The `database` block supports:
6666
* `local_write_operations_per_second` - (Required) Local write operations per second for this active-active region
6767
* `local_read_operations_per_second` - (Required) Local read operations per second for this active-active region
6868

69-
## Attribute Reference
70-
71-
* `latest_backup_status` - A latest_backup_status object, documented below.
72-
73-
The `latest_backup_status` block contains:
74-
75-
* `error` - An error block, in case this lookup failed, documented below.
76-
* `response` - A detail block, documented below.
77-
78-
The `error` block in both `latest_backup_status` contains:
79-
80-
* `type` - The type of error encountered while looking up the status of the last import.
81-
* `description` - A description of the error encountered while looking up the status of the last import.
82-
* `status` - Any particular HTTP status code associated with the erroneous status check.
83-
84-
The `response` block `latest_backup_status` contains:
85-
86-
* `status` - The status of the last backup operation.
87-
* `last_backup_time` - When the last backup operation occurred.
88-
* `failure_reason` - If a failure, why the backup operation failed.
89-
9069
### Timeouts
9170

9271
The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions:

docs/resources/rediscloud_essentials_database.md

-26
Original file line numberDiff line numberDiff line change
@@ -106,32 +106,6 @@ Each `modules` entry provides the following attributes:
106106
* `activated_on` - When this database was activated.
107107
* `public_endpoint` - Public endpoint to access the database.
108108
* `private_endpoint` - Private endpoint to access the database.
109-
* `latest_backup_status` - A latest_backup_status object, documented below.
110-
* `latest_import_status` - A latest_import_status object, documented below.
111-
112-
The `latest_backup_status` and `latest_import_status` blocks contain:
113-
114-
* `error` - An error block, in case this lookup failed, documented below.
115-
* `response` - A detail block, documented below.
116-
117-
The `error` block in both `latest_backup_status` and `latest_import_status` contains:
118-
119-
* `type` - The type of error encountered while looking up the status of the last backup/import.
120-
* `description` - A description of the error encountered while looking up the status of the last backup/import.
121-
* `status` - Any particular HTTP status code associated with the erroneous status check.
122-
123-
The `response` block `latest_backup_status` contains:
124-
125-
* `status` - The status of the last backup operation.
126-
* `last_backup_time` - When the last backup operation occurred.
127-
* `failure_reason` - If a failure, why the backup operation failed.
128-
129-
The `response` block `latest_import_status` contains:
130-
131-
* `status` - The status of the last import operation.
132-
* `last_import_time` - When the last import operation occurred.
133-
* `failure_reason` - If a failure, why the import operation failed.
134-
* `failure_reason_params` - Parameters of the failure, if appropriate, in the form of a list of objects each with a `key` entry and a `value` entry.
135109

136110
## Import
137111
`rediscloud_essentials_database` can be imported using the ID of the subscription and the ID of the database in the format {subscription ID}/{database ID}, e.g.

docs/resources/rediscloud_subscription_database.md

+1-27
Original file line numberDiff line numberDiff line change
@@ -155,32 +155,6 @@ The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/l
155155
* `db_id` - Identifier of the database created
156156
* `public_endpoint` - Public endpoint to access the database
157157
* `private_endpoint` - Private endpoint to access the database
158-
* `latest_backup_status` - A latest_backup_status object, documented below.
159-
* `latest_import_status` - A latest_import_status object, documented below.
160-
161-
The `latest_backup_status` and `latest_import_status` blocks contain:
162-
163-
* `error` - An error block, in case this lookup failed, documented below.
164-
* `response` - A detail block, documented below.
165-
166-
The `error` block in both `latest_backup_status` and `latest_import_status` contains:
167-
168-
* `type` - The type of error encountered while looking up the status of the last backup/import.
169-
* `description` - A description of the error encountered while looking up the status of the last backup/import.
170-
* `status` - Any particular HTTP status code associated with the erroneous status check.
171-
172-
The `response` block `latest_backup_status` contains:
173-
174-
* `status` - The status of the last backup operation.
175-
* `last_backup_time` - When the last backup operation occurred.
176-
* `failure_reason` - If a failure, why the backup operation failed.
177-
178-
The `response` block `latest_import_status` contains:
179-
180-
* `status` - The status of the last import operation.
181-
* `last_import_time` - When the last import operation occurred.
182-
* `failure_reason` - If a failure, why the import operation failed.
183-
* `failure_reason_params` - Parameters of the failure, if appropriate, in the form of a list of objects each with a `key` entry and a `value` entry.
184158

185159
## Import
186160
`rediscloud_subscription_database` can be imported using the ID of the subscription and the ID of the database in the format {subscription ID}/{database ID}, e.g.
@@ -189,4 +163,4 @@ The `response` block `latest_import_status` contains:
189163
$ terraform import rediscloud_subscription_database.database-resource 123456/12345678
190164
```
191165

192-
Note: Due to constraints in the Redis Cloud API, the `memory_limit_in_gb` cannot be set during imports as it is deprecated. If you need to set the `memory_limit_in_gb` attribute, you will need to create a new database resource. It is recommended to use the `dataset_size_in_gb` attribute instead.
166+
Note: Due to constraints in the Redis Cloud API, the `memory_limit_in_gb` cannot be set during imports as it is deprecated. If you need to set the `memory_limit_in_gb` attribute, you will need to create a new database resource. It is recommended to use the `dataset_size_in_gb` attribute instead.

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/RedisLabs/terraform-provider-rediscloud
33
go 1.22.4
44

55
require (
6-
github.com/RedisLabs/rediscloud-go-api v0.20.1
6+
github.com/RedisLabs/rediscloud-go-api v0.21.0
77
github.com/bflad/tfproviderlint v0.30.0
88
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
99
github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc
44
github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
55
github.com/ProtonMail/go-crypto v1.1.0-alpha.2 h1:bkyFVUP+ROOARdgCiJzNQo2V2kiB97LyUpzH9P6Hrlg=
66
github.com/ProtonMail/go-crypto v1.1.0-alpha.2/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE=
7-
github.com/RedisLabs/rediscloud-go-api v0.20.1 h1:imYAb7qi7XCHHQ8IeBo4CUr8KWjiZ8Njj0P84YmqhSI=
8-
github.com/RedisLabs/rediscloud-go-api v0.20.1/go.mod h1:3/oVb71rv2OstFRYEc65QCIbfwnJTgZeQhtPCcdHook=
7+
github.com/RedisLabs/rediscloud-go-api v0.21.0 h1:4f5fz7cfP8zRtmzR4sW7dwmLnxgKgUInxTBMGmc6gFE=
8+
github.com/RedisLabs/rediscloud-go-api v0.21.0/go.mod h1:3/oVb71rv2OstFRYEc65QCIbfwnJTgZeQhtPCcdHook=
99
github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE=
1010
github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
1111
github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec=

provider/datasource_rediscloud_database_modules_test.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ func TestAccDataSourceRedisCloudDatabaseModules_basic(t *testing.T) {
2222
"name": "RediSearch",
2323
}),
2424
resource.TestCheckTypeSetElemNestedAttrs("data.rediscloud_database_modules.foo", "modules.*", map[string]string{
25-
"name": "RedisGraph",
25+
"name": "RedisJSON",
26+
}),
27+
resource.TestCheckTypeSetElemNestedAttrs("data.rediscloud_database_modules.foo", "modules.*", map[string]string{
28+
"name": "RedisTimeSeries",
2629
}),
2730
),
2831
},

provider/rediscloud_active_active_database_test.go

-7
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,6 @@ func TestAccResourceRedisCloudActiveActiveDatabase_CRUDI(t *testing.T) {
194194
"override_region.0.override_global_alert.0.value",
195195
"override_region.0.override_global_data_persistence",
196196
"override_region.0.override_global_password",
197-
"override_region.0.latest_backup_status.#",
198-
"override_region.0.latest_backup_status.0.%",
199-
"override_region.0.latest_backup_status.0.error.#",
200-
"override_region.0.latest_backup_status.0.error.0.%",
201-
"override_region.0.latest_backup_status.0.error.0.description",
202-
"override_region.0.latest_backup_status.0.error.0.status",
203-
"override_region.0.latest_backup_status.0.error.0.type",
204197
},
205198
},
206199
},

0 commit comments

Comments
 (0)