Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
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
12 changes: 12 additions & 0 deletions .github/workflows/terraform_provider_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ jobs:


go_test_smoke_essentials_db:
if: false # Temporarily disabled - waiting on client fixes
name: go test smoke essentials db
needs: go_test_smoke_essentials_sub
runs-on: ubuntu-latest
Expand Down Expand Up @@ -193,6 +194,17 @@ jobs:
go-version-file: go.mod
- run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAcc(RedisCloudProDatabaseBlockPublicEndpoints|ActiveActiveSubscriptionDatabaseBlockPublicEndpoints)"'

go_test_smoke_qpf:
name: go test smoke query performance factor
needs: [ go_build ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version-file: go.mod
- run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAccResourceRedisCloudProDatabase_qpf"'

go_unit_test:
name: go unit test
needs: [go_build]
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
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.1 (27th October 2025)

## Fixed
- rediscloud_subscription_database: The query_performance_factor attribute can now be updated in-place without recreating the database. Previously, any changes to this attribute would force resource replacement.
- rediscloud_subscription_database (Redis 8.0+): Fixed drift detection issues where explicitly configured modules would incorrectly show as changes requiring resource replacement after upgrading to Redis 8.0 or higher. Modules are bundled
by default in Redis 8.0+, so configuration differences are now properly suppressed.
- Test Suite: Fixed incorrect file path references in acceptance tests.

# 2.7.0 (22nd October 2025)

## Added:
Expand Down
30 changes: 27 additions & 3 deletions provider/pro/resource_rediscloud_pro_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ func ResourceRedisCloudProDatabase() *schema.Resource {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
ValidateFunc: func(val interface{}, key string) (warns []string, errs []error) {
v := val.(string)
matched, err := regexp.MatchString(`^([2468])x$`, v)
Expand All @@ -251,8 +250,9 @@ func ResourceRedisCloudProDatabase() *schema.Resource {
ConfigMode: schema.SchemaConfigModeAttr,
Optional: true,
// The API doesn't allow updating/delete modules. Unless we recreate the database.
ForceNew: true,
MinItems: 1,
ForceNew: true,
MinItems: 1,
DiffSuppressFunc: modulesDiffSuppressFunc,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Expand Down Expand Up @@ -1068,6 +1068,30 @@ func shouldWarnRedis8Modules(version string, hasModules bool) bool {
return false
}

// shouldSuppressModuleDiffsForRedis8 checks if module diffs should be suppressed for Redis 8.0 or higher
// In Redis 8.0+, modules are bundled by default, so we should ignore changes to explicitly configured modules
func shouldSuppressModuleDiffsForRedis8(version string) bool {
if len(version) == 0 {
return false
}
majorVersionStr := strings.Split(version, ".")[0]
if majorVersion, err := strconv.Atoi(majorVersionStr); err == nil {
return majorVersion >= 8
}
return false
}

// modulesDiffSuppressFunc returns a DiffSuppressFunc that suppresses module diffs for Redis 8.0+
// This prevents Terraform from showing module changes as "forces replacement" when upgrading to Redis 8.0+
func modulesDiffSuppressFunc(k, oldValue, newValue string, d *schema.ResourceData) bool {
redisVersion, ok := d.GetOk("redis_version")
if !ok {
return false
}
version := redisVersion.(string)
return shouldSuppressModuleDiffsForRedis8(version)
}

func validateModulesForRedis8() schema.CustomizeDiffFunc {
return func(ctx context.Context, diff *schema.ResourceDiff, meta interface{}) error {
redisVersion, versionExists := diff.GetOk("redis_version")
Expand Down
30 changes: 30 additions & 0 deletions provider/pro/resource_rediscloud_pro_database_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,33 @@ 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+)")
}

// TestUnitShouldSuppressModuleDiffsForRedis8_Redis8 tests that module diffs are suppressed for Redis 8.0
func TestUnitShouldSuppressModuleDiffsForRedis8_Redis8(t *testing.T) {
result := shouldSuppressModuleDiffsForRedis8("8.0")
assert.True(t, result, "should suppress module diffs for Redis 8.0")
}

// TestUnitShouldSuppressModuleDiffsForRedis8_Redis82 tests that module diffs are suppressed for Redis 8.2
func TestUnitShouldSuppressModuleDiffsForRedis8_Redis82(t *testing.T) {
result := shouldSuppressModuleDiffsForRedis8("8.2")
assert.True(t, result, "should suppress module diffs for Redis 8.2")
}

// TestUnitShouldSuppressModuleDiffsForRedis8_Redis9 tests that module diffs are suppressed for Redis 9.0
func TestUnitShouldSuppressModuleDiffsForRedis8_Redis9(t *testing.T) {
result := shouldSuppressModuleDiffsForRedis8("9.0")
assert.True(t, result, "should suppress module diffs for Redis 9.0")
}

// TestUnitShouldSuppressModuleDiffsForRedis8_Redis7 tests that module diffs are NOT suppressed for Redis 7.x
func TestUnitShouldSuppressModuleDiffsForRedis8_Redis7(t *testing.T) {
result := shouldSuppressModuleDiffsForRedis8("7.4")
assert.False(t, result, "should not suppress module diffs for Redis 7.4")
}

// TestUnitShouldSuppressModuleDiffsForRedis8_Redis6 tests that module diffs are NOT suppressed for Redis 6.x
func TestUnitShouldSuppressModuleDiffsForRedis8_Redis6(t *testing.T) {
result := shouldSuppressModuleDiffsForRedis8("6.2")
assert.False(t, result, "should not suppress module diffs for Redis 6.2")
}
2 changes: 1 addition & 1 deletion provider/rediscloud_active_active_private_link_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

const testActiveActivePrivateLinkConfigFile = "../privatelink/testdata/active_active_private_link.tf"
const testActiveActivePrivateLinkConfigFile = "./privatelink/testdata/active_active_private_link.tf"

func TestAccResourceRedisCloudActiveActivePrivateLink_CRUDI(t *testing.T) {

Expand Down
8 changes: 4 additions & 4 deletions provider/rediscloud_active_active_subscription_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,21 +486,21 @@ resource "rediscloud_active_active_subscription" "example" {
`

func testAccResourceRedisCloudActiveActiveSubscription(t *testing.T, subscriptionName string) string {
content := utils.GetTestConfig(t, "./activeactive/testdata/testAccResourceRedisCloudActiveActiveSubscription.tf")
content := utils.GetTestConfig(t, "./activeactive/testdata/active_active_sub.tf")
return fmt.Sprintf(content, subscriptionName)
}

func testAccResourceRedisCloudActiveActiveSubscriptionUpdate(t *testing.T, subscriptionName string, cloudProvider string) string {
content := utils.GetTestConfig(t, "./activeactive/testdata/testAccResourceRedisCloudActiveActiveSubscriptionUpdate.tf")
content := utils.GetTestConfig(t, "./activeactive/testdata/subscription_update.tf")
return fmt.Sprintf(content, subscriptionName, cloudProvider)
}

func testAccResourceRedisCloudActiveActiveSubscriptionPublicEndpointDisabled(t *testing.T, subscriptionName string) string {
content := utils.GetTestConfig(t, "./activeactive/testdata/testAccResourceRedisCloudActiveActiveSubscription_PublicEndpointDisabled.tf")
content := utils.GetTestConfig(t, "./activeactive/testdata/public_endpoint_disabled.tf")
return fmt.Sprintf(content, subscriptionName)
}

func testAccResourceRedisCloudActiveActiveSubscriptionPublicEndpointEnabled(t *testing.T, subscriptionName string) string {
content := utils.GetTestConfig(t, "./activeactive/testdata/testAccResourceRedisCloudActiveActiveSubscription_PublicEndpointEnabled.tf")
content := utils.GetTestConfig(t, "./activeactive/testdata/public_endpoint_enabled.tf")
return fmt.Sprintf(content, subscriptionName)
}
9 changes: 4 additions & 5 deletions provider/resource_rediscloud_pro_database_qpf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,11 @@ func TestAccResourceRedisCloudProDatabase_qpf(t *testing.T) {
),
},

// Test plan to ensure query_performance_factor change forces a new resource
// Test that query_performance_factor can be updated without forcing replacement
{
Config: formatDatabaseConfig(name, testCloudAccountName, password, "2x", `modules = [{ name = "RediSearch" }]`),
PlanOnly: true, // Runs terraform plan without applying
ExpectNonEmptyPlan: true, // Ensures that a change is detected
Check: resource.ComposeTestCheckFunc(
Config: formatDatabaseConfig(name, testCloudAccountName, password, "2x", `modules = [{ name = "RediSearch" }]`),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("rediscloud_subscription_database.example", "name", "example"),
resource.TestCheckResourceAttr("rediscloud_subscription_database.example", "query_performance_factor", "2x"),
),
},
Expand Down
2 changes: 2 additions & 0 deletions provider/utils/wait.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ func WaitForDatabaseToBeActive(ctx context.Context, subId, id int, api *client.A
databases.StatusProxyPolicyChangeDraft,
databases.StatusDynamicEndpointsCreationPending,
databases.StatusActiveUpgradePending,
"bdb-update-pending", // Database update in progress.
// TODO replace with api model string in next release
},
Target: []string{databases.StatusActive},
Timeout: SafetyTimeout,
Expand Down