Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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
1 change: 0 additions & 1 deletion .github/workflows/terraform_provider_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ jobs:
go-version-file: go.mod
- run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAccResourceRedisCloudActiveActiveDatabase_CRUDI"'


go_test_smoke_essentials_sub:
name: go test smoke essentials sub
needs: [go_build]
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ website/node_modules
website/vendor
vendor
.vscode/
.claude/
CLAUDE.md

# Test exclusions
!command/test-fixtures/**/*.tfstate
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
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.4.5 (9th October 2025)

## Added:
- Support for the global_enable_default_user attribute to Active-Active database resources, allowing users to control whether the default Redis user is enabled across all regions.

# 2.4.4 (3rd October 2025)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,21 @@ The following arguments are supported:
* `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.**
* `name` - (Required) A meaningful name to identify the database. **Modifying this attribute will force creation of a new resource.**
* `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.**
* `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 favor of `dataset_size_in_gb` - not possible to import databases with this attribute set**
* `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 favor of `dataset_size_in_gb` - not possible to import databases with this attribute set**
* `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
* `support_oss_cluster_api` - (Optional) Support Redis open-source (OSS) Cluster API. Default: ‘false’
* `external_endpoint_for_oss_cluster_api` - (Optional) Should use the external endpoint for open-source (OSS) Cluster API.
Can only be enabled if OSS Cluster API support is enabled. Default: 'false'
* `enable_tls` - (Optional) Use TLS for authentication. Default: ‘false’
`client_ssl_certificate` - (Optional) SSL certificate to authenticate user connections, conflicts with `client_tls_certificates`
* `client_ssl_certificate` - (Optional) SSL certificate to authenticate user connections, conflicts with `client_tls_certificates`
* `client_tls_certificates` - (Optional) A list of TLS certificates to authenticate user connections, conflicts with `client_ssl_certificate`
* `data_eviction` - (Optional) The data items eviction policy (either: 'allkeys-lru', 'allkeys-lfu', 'allkeys-random', 'volatile-lru', 'volatile-lfu', 'volatile-random', 'volatile-ttl' or 'noeviction'. Default: 'volatile-lru')
* `global_data_persistence` - (Optional) Global rate of database data persistence (in persistent storage) of regions that dont override global settings. Default: 'none'
* `global_password` - (Optional) Password to access the database of regions that don't override global settings. If left empty, the password will be generated automatically
* `global_alert` - (Optional) A block defining Redis database alert of regions that don't override global settings, documented below, can be specified multiple times. (either: 'dataset-size', 'datasets-size', 'throughput-higher-than', 'throughput-lower-than', 'latency', 'syncsource-error', 'syncsource-lag' or 'connections-limit')
* `global_modules` - (Optional) A list of modules to be enabled on all deployments of this database. Supported modules: `RedisJSON`, `RediSearch`. Ignored after database creation.
* `global_source_ips` - (Optional) List of source IP addresses or subnet masks of regions that don't override global settings. If specified, Redis clients will be able to connect to this database only from within the specified source IP addresses ranges (example: ['192.168.10.0/32', '192.168.12.0/24'])
* `global_enable_default_user` - (Optional) When 'true', enables connecting to the database with the 'default' user across all regions. Default: 'true'
* `global_resp_version` - (Optional) Either 'resp2' or 'resp3'. Resp version for Crdb databases within the AA database. Must be compatible with Redis version.
* `port` - (Optional) TCP port on which the database is available - must be between 10000 and 19999. **Modifying this attribute will force creation of a new resource.**
* `override_region` - (Optional) Override region specific configuration, documented below
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.36.5
github.com/RedisLabs/rediscloud-go-api v0.37.0
github.com/bflad/tfproviderlint v0.31.0
github.com/hashicorp/go-cty v1.5.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.37.0
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.36.5 h1:zZ5C2+QHdfdlGqZDw3o2GMM7Wz5BhLUUW8U3yGFl1ck=
github.com/RedisLabs/rediscloud-go-api v0.36.5/go.mod h1:Hkh3i/EsHnyfgV0ijednbofz/EmZC3sFnSNNruF3G6I=
github.com/RedisLabs/rediscloud-go-api v0.37.0 h1:qnu9mfGqOPZSMi17r3OwATzN72OkMkBPxjyWn619LBY=
github.com/RedisLabs/rediscloud-go-api v0.37.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
2 changes: 1 addition & 1 deletion provider/privatelink/testdata/private_link_update.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ resource "rediscloud_subscription" "pro_subscription" {
}

creation_plan {
dataset_size_in_gb = 15
dataset_size_in_gb = 1
quantity = 1
replication = true
throughput_measurement_by = "operations-per-second"
Expand Down
2 changes: 1 addition & 1 deletion provider/privatelink/testdata/pro_private_link.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ resource "rediscloud_subscription" "pro_subscription" {
}

creation_plan {
dataset_size_in_gb = 15
dataset_size_in_gb = 1
quantity = 1
replication = true
throughput_measurement_by = "operations-per-second"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ resource "rediscloud_subscription_database" "example" {
subscription_id = rediscloud_subscription.example.id
name = "example"
protocol = "redis"
dataset_size_in_gb = 3
dataset_size_in_gb = 1
data_persistence = "none"
data_eviction = "allkeys-random"
throughput_measurement_by = "operations-per-second"
Expand Down
2 changes: 1 addition & 1 deletion provider/psc/testdata/testPrivateServiceConnect1.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ resource "rediscloud_subscription" "subscription_resource" {
}

creation_plan {
dataset_size_in_gb = 15
dataset_size_in_gb = 1
quantity = 1
replication = true
throughput_measurement_by = "operations-per-second"
Expand Down
23 changes: 14 additions & 9 deletions provider/rediscloud_active_active_database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ package provider
import (
"context"
"fmt"
client2 "github.com/RedisLabs/terraform-provider-rediscloud/provider/client"
"os"
"regexp"
"strconv"
"testing"

"github.com/RedisLabs/rediscloud-go-api/redis"
"github.com/RedisLabs/terraform-provider-rediscloud/provider/client"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
Expand Down Expand Up @@ -39,7 +39,7 @@ func TestAccResourceRedisCloudActiveActiveDatabase_CRUDI(t *testing.T) {
Check: resource.ComposeAggregateTestCheckFunc(
// Test resource
resource.TestCheckResourceAttr(databaseResourceName, "name", databaseName),
resource.TestCheckResourceAttr(databaseResourceName, "dataset_size_in_gb", "3"),
resource.TestCheckResourceAttr(databaseResourceName, "dataset_size_in_gb", "1"),
resource.TestCheckResourceAttr(databaseResourceName, "support_oss_cluster_api", "false"),
resource.TestCheckResourceAttr(databaseResourceName, "global_data_persistence", "none"),
resource.TestCheckResourceAttr(databaseResourceName, "external_endpoint_for_oss_cluster_api", "false"),
Expand All @@ -52,6 +52,7 @@ func TestAccResourceRedisCloudActiveActiveDatabase_CRUDI(t *testing.T) {
resource.TestCheckResourceAttr(databaseResourceName, "global_modules.#", "1"),
resource.TestCheckResourceAttr(databaseResourceName, "global_modules.0", "RedisJSON"),
resource.TestCheckResourceAttr(databaseResourceName, "global_source_ips.#", "2"),
resource.TestCheckResourceAttr(databaseResourceName, "global_enable_default_user", "true"),

resource.TestCheckResourceAttr(databaseResourceName, "override_region.#", "2"),
resource.TestCheckResourceAttr(databaseResourceName, "override_region.0.name", "us-east-1"),
Expand Down Expand Up @@ -84,8 +85,8 @@ func TestAccResourceRedisCloudActiveActiveDatabase_CRUDI(t *testing.T) {
return fmt.Errorf("couldn't parse the subscription ID: %s", redis.StringValue(&r.Primary.ID))
}

client := testProvider.Meta().(*client2.ApiClient)
sub, err := client.Client.Subscription.Get(context.TODO(), subId)
apiClient := testProvider.Meta().(*client.ApiClient)
sub, err := apiClient.Client.Subscription.Get(context.TODO(), subId)
if err != nil {
return err
}
Expand All @@ -94,7 +95,7 @@ func TestAccResourceRedisCloudActiveActiveDatabase_CRUDI(t *testing.T) {
return fmt.Errorf("unexpected name value: %s", redis.StringValue(sub.Name))
}

listDb := client.Client.Database.List(context.TODO(), subId)
listDb := apiClient.Client.Database.List(context.TODO(), subId)
if listDb.Next() != true {
return fmt.Errorf("no database found: %s", listDb.Err())
}
Expand All @@ -109,7 +110,7 @@ func TestAccResourceRedisCloudActiveActiveDatabase_CRUDI(t *testing.T) {
resource.TestCheckResourceAttrSet(datasourceName, "subscription_id"),
resource.TestCheckResourceAttrSet(datasourceName, "db_id"),
resource.TestCheckResourceAttr(datasourceName, "name", databaseName),
resource.TestCheckResourceAttr(datasourceName, "dataset_size_in_gb", "3"),
resource.TestCheckResourceAttr(datasourceName, "dataset_size_in_gb", "1"),
resource.TestCheckResourceAttr(datasourceName, "support_oss_cluster_api", "false"),
resource.TestCheckResourceAttr(datasourceName, "external_endpoint_for_oss_cluster_api", "false"),
resource.TestCheckResourceAttr(datasourceName, "enable_tls", "false"),
Expand Down Expand Up @@ -145,6 +146,7 @@ func TestAccResourceRedisCloudActiveActiveDatabase_CRUDI(t *testing.T) {
resource.TestCheckResourceAttr(databaseResourceName, "global_alert.#", "1"),
resource.TestCheckResourceAttr(databaseResourceName, "global_alert.0.name", "dataset-size"),
resource.TestCheckResourceAttr(databaseResourceName, "global_alert.0.value", "60"),
resource.TestCheckResourceAttr(databaseResourceName, "global_enable_default_user", "false"),
resource.TestCheckResourceAttr(databaseResourceName, "redis_version", "7.2"),

// Changes are ignored after creation
Expand Down Expand Up @@ -200,6 +202,7 @@ func TestAccResourceRedisCloudActiveActiveDatabase_CRUDI(t *testing.T) {
"global_password",
"global_source_ips.#",
"global_source_ips.0",
"global_enable_default_user",
"override_region.#",
"override_region.0.%",
"override_region.0.name",
Expand Down Expand Up @@ -299,7 +302,7 @@ const testAccResourceRedisCloudActiveActiveDatabase = activeActiveSubscriptionBo
resource "rediscloud_active_active_subscription_database" "example" {
subscription_id = rediscloud_active_active_subscription.example.id
name = "%s"
dataset_size_in_gb = 3
dataset_size_in_gb = 1
support_oss_cluster_api = false
external_endpoint_for_oss_cluster_api = false
enable_tls = false
Expand All @@ -312,6 +315,7 @@ resource "rediscloud_active_active_subscription_database" "example" {
name = "dataset-size"
value = 1
}
global_enable_default_user = true
global_modules = ["RedisJSON"]
override_region {
name = "us-east-1"
Expand Down Expand Up @@ -360,6 +364,7 @@ resource "rediscloud_active_active_subscription_database" "example" {
name = "dataset-size"
value = 60
}
global_enable_default_user = false
global_modules = []

override_region {
Expand Down Expand Up @@ -442,7 +447,7 @@ resource "rediscloud_active_active_subscription" "example" {
resource "rediscloud_active_active_subscription_database" "example" {
subscription_id = rediscloud_active_active_subscription.example.id
name = "%s"
dataset_size_in_gb = 3
dataset_size_in_gb = 1
support_oss_cluster_api = false
external_endpoint_for_oss_cluster_api = false
enable_tls = false
Expand Down Expand Up @@ -476,7 +481,7 @@ const testAccResourceRedisCloudActiveActiveDatabaseInvalidTimeUtc = activeActive
resource "rediscloud_active_active_subscription_database" "example" {
subscription_id = rediscloud_active_active_subscription.example.id
name = "%s"
dataset_size_in_gb = 3
dataset_size_in_gb = 1
support_oss_cluster_api = false
external_endpoint_for_oss_cluster_api = false
enable_tls = false
Expand Down
37 changes: 27 additions & 10 deletions provider/rediscloud_essentials_subscription_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,36 @@ import (
"context"
"flag"
"fmt"
"regexp"
"strconv"
"testing"

"github.com/RedisLabs/rediscloud-go-api/redis"
client2 "github.com/RedisLabs/terraform-provider-rediscloud/provider/client"
"github.com/RedisLabs/terraform-provider-rediscloud/provider/client"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
"regexp"
"strconv"
"testing"
)

var essentialsMarketplaceFlag = flag.Bool("essentialsMarketplace", false,
"Add this flag '-essentialsMarketplace' to run tests for marketplace associated accounts")

// testAccPreCheckEssentialsSubscription checks if an essentials subscription already exists
// and fails fast to avoid the test failing after provisioning attempts
func testAccPreCheckEssentialsSubscription(t *testing.T) {
testAccPreCheck(t)

apiClient := testProvider.Meta().(*client.ApiClient)
subs, err := apiClient.Client.FixedSubscriptions.List(context.TODO())
if err != nil {
t.Fatalf("Failed to list essentials subscriptions: %v", err)
}

if len(subs) > 0 {
t.Skipf("Essentials subscription already exists (ID: %d). Redis Cloud allows only 1 essentials subscription per account. Please delete the existing subscription before running this test.", redis.IntValue(subs[0].ID))
}
}

func TestAccResourceRedisCloudEssentialsSubscription_Free_CRUDI(t *testing.T) {

testAccRequiresEnvVar(t, "EXECUTE_TESTS")
Expand All @@ -28,7 +45,7 @@ func TestAccResourceRedisCloudEssentialsSubscription_Free_CRUDI(t *testing.T) {
const datasourceName = "data.rediscloud_essentials_subscription.example"

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
PreCheck: func() { testAccPreCheckEssentialsSubscription(t) },
ProviderFactories: providerFactories,
CheckDestroy: testAccCheckEssentialsSubscriptionDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -93,7 +110,7 @@ func TestAccResourceRedisCloudEssentialsSubscription_Paid_CreditCard_CRUDI(t *te
const datasourceName = "data.rediscloud_essentials_subscription.example"

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
PreCheck: func() { testAccPreCheckEssentialsSubscription(t) },
ProviderFactories: providerFactories,
CheckDestroy: testAccCheckEssentialsSubscriptionDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -159,7 +176,7 @@ func TestAccResourceRedisCloudEssentialsSubscription_Paid_NoPaymentType_CRUDI(t
const datasourceName = "data.rediscloud_essentials_subscription.example"

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
PreCheck: func() { testAccPreCheckEssentialsSubscription(t) },
ProviderFactories: providerFactories,
CheckDestroy: testAccCheckEssentialsSubscriptionDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -230,7 +247,7 @@ func TestAccResourceRedisCloudEssentialsSubscription_Paid_Marketplace_CRUDI(t *t
const datasourceName = "data.rediscloud_essentials_subscription.example"

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
PreCheck: func() { testAccPreCheckEssentialsSubscription(t) },
ProviderFactories: providerFactories,
CheckDestroy: testAccCheckEssentialsSubscriptionDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -414,7 +431,7 @@ data "rediscloud_essentials_subscription" "example" {
`

func testAccCheckEssentialsSubscriptionDestroy(s *terraform.State) error {
client := testProvider.Meta().(*client2.ApiClient)
apiClient := testProvider.Meta().(*client.ApiClient)

for _, r := range s.RootModule().Resources {
if r.Type != "rediscloud_essentials_subscription" {
Expand All @@ -426,7 +443,7 @@ func testAccCheckEssentialsSubscriptionDestroy(s *terraform.State) error {
return err
}

subs, err := client.Client.FixedSubscriptions.List(context.TODO())
subs, err := apiClient.Client.FixedSubscriptions.List(context.TODO())
if err != nil {
return err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ resource "rediscloud_subscription" "subscription" {
}

creation_plan {
dataset_size_in_gb = 15
dataset_size_in_gb = 1
quantity = 1
replication = true
throughput_measurement_by = "operations-per-second"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ resource "rediscloud_subscription" "subscription_resource" {
}

creation_plan {
dataset_size_in_gb = 15
dataset_size_in_gb = 1
quantity = 1
replication = true
throughput_measurement_by = "operations-per-second"
Expand Down
2 changes: 1 addition & 1 deletion provider/rediscloud_private_service_connect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ resource "rediscloud_subscription" "subscription_resource" {
}

creation_plan {
dataset_size_in_gb = 15
dataset_size_in_gb = 1
quantity = 1
replication = true
throughput_measurement_by = "operations-per-second"
Expand Down
Loading
Loading