Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
11ac8b4
test: fixing failing tests
burythehammer Oct 20, 2025
b45d496
test: expectations are standard if the subscription and database leve…
burythehammer Oct 20, 2025
68b55f7
test: changing query performance factor to be in there but only in db…
burythehammer Oct 20, 2025
8eebe69
fix: change error for redis 8 modules to warning
burythehammer Oct 21, 2025
bad7b58
chore: adding debug to essentials db creation
burythehammer Oct 22, 2025
a14286c
chore: go mod dep bump
burythehammer Oct 22, 2025
21addda
fix: module would not warn on redis 9. Extracted out method and unit …
burythehammer Oct 22, 2025
9f9a556
feat: read auto minor version upgrade and set it in state
burythehammer Oct 22, 2025
3d7eba0
chore: added logging to the essentials database creation
burythehammer Oct 22, 2025
5fbc649
chore: moving activeactive test data to the correct folder
burythehammer Oct 22, 2025
05d00b6
fix: stopping essentials databases sending incorrect source IPs when …
burythehammer Oct 22, 2025
c92825b
docs: changelog for 2.7.0
burythehammer Oct 22, 2025
68ae440
docs: changelog
burythehammer Oct 22, 2025
5d6fb6d
fix: revert essentials database source ip fix as this will be fixed A…
burythehammer Oct 23, 2025
f02fa57
chore(deps): bump actions/setup-go from 5.5.0 to 6.0.0
dependabot[bot] Oct 1, 2025
a1cc856
chore(deps): bump github/codeql-action from 3 to 4
dependabot[bot] Oct 17, 2025
ed4de4d
fix: essentials databases now warn if modules are detected
burythehammer Oct 23, 2025
c772416
chore: changing to deferred unlock on mutex
burythehammer Oct 23, 2025
c9bf7be
chore: further deferred unlock fixes and implementations
burythehammer Oct 23, 2025
892dfd8
fix: defer unlock crashes
burythehammer Oct 23, 2025
10bae1e
chore: cleaning up comments
burythehammer Oct 23, 2025
88c1131
chore: removing debug logging for essentials dbs
burythehammer Oct 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -51,7 +51,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3
uses: github/codeql-action/autobuild@v4

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -65,4 +65,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@v4
2 changes: 1 addition & 1 deletion .github/workflows/terraform_provider_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version-file: go.mod
- run: go test ./... -run="^TestUnit" # Runs tests starting with TestUnit
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/terraform_provider_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version-file: go.mod
- run: go test ./... -run="^TestUnit" # Runs tests starting with TestUnit
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
All notable changes to this project will be documented in this file.
See updating [Changelog example here](https://keepachangelog.com/en/1.0.0/)

# 2.7.0 (22nd October 2025)

## Added:
- Add auto_minor_version_upgrade field to Pro and Active-Active database resources (default: true) to allow users to control automatic minor version upgrades. This will NOT affect existing databases.

## Changed:
- Change Redis 8.0 modules validation from hard error to warning since modules are bundled by default in Redis 8+.

## Fixed:
- Fix test error message patterns to match updated API error format.
- Fix Redis 8 upgrade test expectation (dataset_size_in_gb: 3→1).


# 2.6.0 (17th October 2025)

## Added:
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.24.0
toolchain go1.24.1

require (
github.com/RedisLabs/rediscloud-go-api v0.38.0
github.com/RedisLabs/rediscloud-go-api v0.39.0
github.com/bflad/tfproviderlint v0.31.0
github.com/hashicorp/go-cty v1.5.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.38.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERo
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
github.com/ProtonMail/go-crypto v1.1.6 h1:ZcV+Ropw6Qn0AX9brlQLAUXfqLBc7Bl+f/DmNxpLfdw=
github.com/ProtonMail/go-crypto v1.1.6/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE=
github.com/RedisLabs/rediscloud-go-api v0.38.0 h1:lLOS0E8tQhUzuUfb/H+QWtDaZrC9xNnTvAPBygH4WS8=
github.com/RedisLabs/rediscloud-go-api v0.38.0/go.mod h1:Hkh3i/EsHnyfgV0ijednbofz/EmZC3sFnSNNruF3G6I=
github.com/RedisLabs/rediscloud-go-api v0.39.0 h1:VNI7VyP9V41Z8FP558v60WCJFBB57AGuQQq3QY4t2VU=
github.com/RedisLabs/rediscloud-go-api v0.39.0/go.mod h1:Hkh3i/EsHnyfgV0ijednbofz/EmZC3sFnSNNruF3G6I=
github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE=
github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec=
Expand Down
44 changes: 44 additions & 0 deletions provider/activeactive/testdata/auto_minor_version_upgrade.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
locals {
rediscloud_cloud_account = "%s"
rediscloud_subscription_name = "%s"
}

data "rediscloud_payment_method" "card" {
card_type = "Visa"
last_four_numbers = "5556"
}

data "rediscloud_cloud_account" "account" {
exclude_internal_account = true
provider_type = "AWS"
name = local.rediscloud_cloud_account
}

resource "rediscloud_active_active_subscription" "example" {
name = local.rediscloud_subscription_name
payment_method_id = data.rediscloud_payment_method.card.id
storage_encryption = true

region {
region = "eu-west-1"
networking_deployment_cidr = "10.0.0.0/24"
preferred_availability_zones = ["eu-west-1a"]
}

region {
region = "us-east-1"
networking_deployment_cidr = "10.1.0.0/24"
preferred_availability_zones = ["us-east-1a"]
}
}

resource "rediscloud_active_active_subscription_database" "example" {
subscription_id = rediscloud_active_active_subscription.example.id
name = "auto-minor-version-upgrade-test"
protocol = "redis"
dataset_size_in_gb = 1
data_eviction = "allkeys-random"
throughput_measurement_by = "operations-per-second"
throughput_measurement_value = 1000
auto_minor_version_upgrade = %s
}
53 changes: 41 additions & 12 deletions provider/pro/resource_rediscloud_pro_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,12 @@ func ResourceRedisCloudProDatabase() *schema.Resource {
Optional: true,
Default: true,
},
"auto_minor_version_upgrade": {
Description: "When 'true', enables auto minor version upgrades for this database. Default: 'true'",
Type: schema.TypeBool,
Optional: true,
Default: true,
},
"port": {
Description: "TCP port on which the database is available",
Type: schema.TypeInt,
Expand Down Expand Up @@ -436,8 +442,13 @@ func resourceRedisCloudProDatabaseCreate(ctx context.Context, d *schema.Resource
createDatabase.RespVersion = s
})

utils.SetBool(d, "auto_minor_version_upgrade", func(b *bool) {
createDatabase.AutoMinorVersionUpgrade = b
})

// Confirm sub is ready to accept a db request
if err := utils.WaitForSubscriptionToBeActive(ctx, subId, api); err != nil {
utils.SubscriptionMutex.Unlock(subId)
return diag.FromErr(err)
}

Expand Down Expand Up @@ -656,6 +667,10 @@ func resourceRedisCloudProDatabaseRead(ctx context.Context, d *schema.ResourceDa
}
}

if err := d.Set("auto_minor_version_upgrade", redis.BoolValue(db.AutoMinorVersionUpgrade)); err != nil {
return diag.FromErr(err)
}

if err := ReadTags(ctx, api, subId, dbId, d); err != nil {
return diag.FromErr(err)
}
Expand Down Expand Up @@ -731,12 +746,13 @@ func resourceRedisCloudProDatabaseUpdate(ctx context.Context, d *schema.Resource
Value: utils.GetInt(d, "throughput_measurement_value"),
},

DataPersistence: utils.GetString(d, "data_persistence"),
DataEvictionPolicy: utils.GetString(d, "data_eviction"),
SourceIP: utils.SetToStringSlice(d.Get("source_ips").(*schema.Set)),
Alerts: &alerts,
RemoteBackup: BuildBackupPlan(d.Get("remote_backup").([]interface{}), d.Get("periodic_backup_path")),
EnableDefaultUser: utils.GetBool(d, "enable_default_user"),
DataPersistence: utils.GetString(d, "data_persistence"),
DataEvictionPolicy: utils.GetString(d, "data_eviction"),
SourceIP: utils.SetToStringSlice(d.Get("source_ips").(*schema.Set)),
Alerts: &alerts,
RemoteBackup: BuildBackupPlan(d.Get("remote_backup").([]interface{}), d.Get("periodic_backup_path")),
EnableDefaultUser: utils.GetBool(d, "enable_default_user"),
AutoMinorVersionUpgrade: utils.GetBool(d, "auto_minor_version_upgrade"),
}

// One of the following fields must be set, validation is handled in the schema (ExactlyOneOf)
Expand Down Expand Up @@ -1037,19 +1053,32 @@ func containsDBModule(modules []map[string]interface{}, moduleName string) bool
return false
}

// shouldWarnRedis8Modules checks if a warning should be issued for modules in Redis 8.0 or higher
func shouldWarnRedis8Modules(version string, hasModules bool) bool {
if !hasModules {
return false
}
// Extract major version (first character before the dot)
if len(version) > 0 {
majorVersionStr := strings.Split(version, ".")[0]
if majorVersion, err := strconv.Atoi(majorVersionStr); err == nil {
return majorVersion >= 8
}
}
return false
}

func validateModulesForRedis8() schema.CustomizeDiffFunc {
return func(ctx context.Context, diff *schema.ResourceDiff, meta interface{}) error {
redisVersion, versionExists := diff.GetOk("redis_version")
modules, modulesExists := diff.GetOkExists("modules")

if versionExists && modulesExists {
version := redisVersion.(string)
// Check if version is >= 8.0
if strings.HasPrefix(version, "8.") {
moduleSet := modules.(*schema.Set)
if moduleSet.Len() > 0 {
return fmt.Errorf(`"modules" cannot be explicitly set for Redis version %s as modules are bundled by default. Remove the "modules" field from your configuration`, version)
}
moduleSet := modules.(*schema.Set)

if shouldWarnRedis8Modules(version, moduleSet.Len() > 0) {
log.Printf("[WARN] Modules are bundled by default in Redis %s. You should remove the modules block as it is deprecated for this version.", version)
}
}
return nil
Expand Down
67 changes: 67 additions & 0 deletions provider/pro/resource_rediscloud_pro_database_validation_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package pro

import (
"testing"

"github.com/stretchr/testify/assert"
)

// TestUnitShouldWarnRedis8Modules_Redis8WithModules tests that warning is triggered for Redis 8.0 with modules
func TestUnitShouldWarnRedis8Modules_Redis8WithModules(t *testing.T) {
result := shouldWarnRedis8Modules("8.0", true)
assert.True(t, result, "should warn for Redis 8.0 with modules")
}

// TestUnitShouldWarnRedis8Modules_Redis80WithModules tests that warning is triggered for Redis 8.0.0 with modules
func TestUnitShouldWarnRedis8Modules_Redis80WithModules(t *testing.T) {
result := shouldWarnRedis8Modules("8.0.0", true)
assert.True(t, result, "should warn for Redis 8.0.0 with modules")
}

// TestUnitShouldWarnRedis8Modules_Redis81WithModules tests that warning is triggered for Redis 8.1+ with modules
func TestUnitShouldWarnRedis8Modules_Redis81WithModules(t *testing.T) {
result := shouldWarnRedis8Modules("8.1.0", true)
assert.True(t, result, "should warn for Redis 8.1.0 with modules")
}

// TestUnitShouldWarnRedis8Modules_Redis89WithModules tests that warning is triggered for Redis 8.9+ with modules
func TestUnitShouldWarnRedis8Modules_Redis89WithModules(t *testing.T) {
result := shouldWarnRedis8Modules("8.9.9", true)
assert.True(t, result, "should warn for Redis 8.9.9 with modules")
}

// TestUnitShouldWarnRedis8Modules_Redis7WithModules tests that no warning for Redis 7.x with modules
func TestUnitShouldWarnRedis8Modules_Redis7WithModules(t *testing.T) {
result := shouldWarnRedis8Modules("7.4", true)
assert.False(t, result, "should not warn for Redis 7.4 with modules")
}

// TestUnitShouldWarnRedis8Modules_Redis6WithModules tests that no warning for Redis 6.x with modules
func TestUnitShouldWarnRedis8Modules_Redis6WithModules(t *testing.T) {
result := shouldWarnRedis8Modules("6.2", true)
assert.False(t, result, "should not warn for Redis 6.2 with modules")
}

// TestUnitShouldWarnRedis8Modules_Redis8NoModules tests that no warning for Redis 8.0 without modules
func TestUnitShouldWarnRedis8Modules_Redis8NoModules(t *testing.T) {
result := shouldWarnRedis8Modules("8.0", false)
assert.False(t, result, "should not warn for Redis 8.0 without modules")
}

// TestUnitShouldWarnRedis8Modules_Redis7NoModules tests that no warning for Redis 7.x without modules
func TestUnitShouldWarnRedis8Modules_Redis7NoModules(t *testing.T) {
result := shouldWarnRedis8Modules("7.4", false)
assert.False(t, result, "should not warn for Redis 7.4 without modules")
}

// TestUnitShouldWarnRedis8Modules_Redis9WithModules tests that warning is triggered for Redis 9.x with modules (future-proofing)
func TestUnitShouldWarnRedis8Modules_Redis9WithModules(t *testing.T) {
result := shouldWarnRedis8Modules("9.0", true)
assert.True(t, result, "should warn for Redis 9.0 with modules (modules bundled in 8.0+)")
}

// TestUnitShouldWarnRedis8Modules_Redis10WithModules tests that warning is triggered for Redis 10.x with modules
func TestUnitShouldWarnRedis8Modules_Redis10WithModules(t *testing.T) {
result := shouldWarnRedis8Modules("10.0.0", true)
assert.True(t, result, "should warn for Redis 10.0.0 with modules (modules bundled in 8.0+)")
}
50 changes: 50 additions & 0 deletions provider/pro/testdata/pro_database_auto_minor_version_upgrade.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
locals {
rediscloud_cloud_account = "%s"
rediscloud_subscription_name = "%s"
auto_minor_version_upgrade = %s
}

data "rediscloud_payment_method" "card" {
card_type = "Visa"
last_four_numbers = "5556"
}

data "rediscloud_cloud_account" "account" {
exclude_internal_account = true
provider_type = "AWS"
name = local.rediscloud_cloud_account
}

resource "rediscloud_subscription" "example" {
name = local.rediscloud_subscription_name
payment_method_id = data.rediscloud_payment_method.card.id
memory_storage = "ram"
cloud_provider {
provider = data.rediscloud_cloud_account.account.provider_type
cloud_account_id = data.rediscloud_cloud_account.account.id
region {
region = "eu-west-1"
networking_deployment_cidr = "10.0.0.0/24"
preferred_availability_zones = ["eu-west-1a"]
}
}

creation_plan {
memory_limit_in_gb = 1
quantity = 1
replication = false
throughput_measurement_by = "operations-per-second"
throughput_measurement_value = 1000
}
}

resource "rediscloud_subscription_database" "example" {
subscription_id = rediscloud_subscription.example.id
name = "auto-minor-version-upgrade-test"
protocol = "redis"
memory_limit_in_gb = 1
data_persistence = "none"
throughput_measurement_by = "operations-per-second"
throughput_measurement_value = 1000
auto_minor_version_upgrade = local.auto_minor_version_upgrade
}
Loading
Loading