Skip to content

Commit 24f1e8c

Browse files
committed
fix: reversing optional upgrade flag. Changing redis_version to computable
1 parent a50b791 commit 24f1e8c

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

provider/resource_rediscloud_pro_database.go

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -241,13 +241,7 @@ func resourceRedisCloudProDatabase() *schema.Resource {
241241
Description: "Defines the Redis database version. If omitted, the Redis version will be set to the default version",
242242
Type: schema.TypeString,
243243
Optional: true,
244-
Default: "",
245-
},
246-
"enable_redis_version_upgrade": {
247-
Description: "Enables Redis version upgrades. Default false. Will only upgrade the redis database to a new version if enabled",
248-
Type: schema.TypeBool,
249-
Optional: true,
250-
Default: false,
244+
Computed: true,
251245
},
252246
"modules": {
253247
Description: "Modules to be provisioned in the database",
@@ -793,17 +787,14 @@ func resourceRedisCloudProDatabaseUpdate(ctx context.Context, d *schema.Resource
793787
}
794788

795789
// if redis_version has changed, then upgrade first
796-
if d.Get("enable_redis_version_upgrade").(bool) && d.HasChange("redis_version") {
790+
if d.HasChange("redis_version") {
797791
// if we have just created the database, it will detect an upgrade unnecessarily
798792
originalVersion, newVersion := d.GetChange("redis_version")
799793

800-
ogVersionStr := originalVersion.(string)
801-
newVersionStr := newVersion.(string)
802-
803794
// if either version is blank, it could attempt to upgrade unnecessarily.
804795
// only upgrade when a known version goes to another known version
805-
if ogVersionStr != "" && newVersionStr != "" {
806-
if diags, unlocked := upgradeRedisVersion(ctx, api, subId, dbId, newVersionStr); diags != nil {
796+
if originalVersion.(string) != "" && newVersion.(string) != "" {
797+
if diags, unlocked := upgradeRedisVersion(ctx, api, subId, dbId, newVersion.(string)); diags != nil {
807798
if !unlocked {
808799
subscriptionMutex.Unlock(subId)
809800
}

0 commit comments

Comments
 (0)