From 620310c9998cdf135953654f15eb443674a098b5 Mon Sep 17 00:00:00 2001 From: JohnSharpe Date: Tue, 27 Aug 2024 09:38:27 +0100 Subject: [PATCH] Updated docs, reintroduced some very short delays before Waiting and removed redisearch/throughput validation --- docs/index.md | 2 +- ...oud_active_active_subscription_database.md | 3 +- .../rediscloud_subscription_database.md | 3 +- .../resource_rediscloud_pro_subscription.go | 22 +------ ...source_rediscloud_pro_subscription_test.go | 61 ------------------- 5 files changed, 8 insertions(+), 83 deletions(-) diff --git a/docs/index.md b/docs/index.md index 99172b27..435f66a3 100644 --- a/docs/index.md +++ b/docs/index.md @@ -13,7 +13,7 @@ Use the navigation to the left to read about the available provider resources an ## Configure Redis Enterprise Cloud Programmatic Access -In order to setup authentication with the Redis Enterprise Cloud provider a programmatic API key must be generated for Redis Enterprise Cloud. The [Redis Enterprise Cloud documentation](https://docs.redislabs.com/latest/rc/api/how-to/enable-your-account-to-use-api/) contains the most up-to-date instructions for creating and managing your key(s) and IP access. +In order to setup authentication with the Redis Enterprise Cloud provider a programmatic API key must be generated for Redis Enterprise Cloud. The [Redis Enterprise Cloud documentation](https://redis.io/docs/latest/integrate/terraform-provider-for-redis-cloud/) contains the most up-to-date instructions for creating and managing your key(s) and IP access. ## Example Usage diff --git a/docs/resources/rediscloud_active_active_subscription_database.md b/docs/resources/rediscloud_active_active_subscription_database.md index 94cefd89..dbbc8e73 100644 --- a/docs/resources/rediscloud_active_active_subscription_database.md +++ b/docs/resources/rediscloud_active_active_subscription_database.md @@ -90,7 +90,8 @@ The following arguments are supported: * `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. + `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 diff --git a/docs/resources/rediscloud_subscription_database.md b/docs/resources/rediscloud_subscription_database.md index 36baf72f..f492a526 100644 --- a/docs/resources/rediscloud_subscription_database.md +++ b/docs/resources/rediscloud_subscription_database.md @@ -84,7 +84,8 @@ The following arguments are supported: * `resp_version` - (Optional) Either `resp2` or `resp3`. Database's RESP version. Must be compatible with the Redis version. * `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' -* `client_ssl_certificate` - (Optional) SSL certificate to authenticate user connections +* `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` * `periodic_backup_path` - (Optional) Path that will be used to store database backup files. **Deprecated: Use `remote_backup` block instead** * `replica_of` - (Optional) Set of Redis database URIs, in the format `redis://user:password@host:port`, that this database will be a replica of. If the URI provided is Redis Labs Cloud instance, only host and port should be provided. diff --git a/provider/resource_rediscloud_pro_subscription.go b/provider/resource_rediscloud_pro_subscription.go index 5ce047c3..f5dafd8a 100644 --- a/provider/resource_rediscloud_pro_subscription.go +++ b/provider/resource_rediscloud_pro_subscription.go @@ -794,25 +794,6 @@ func buildSubscriptionCreatePlanDatabases(memoryStorage string, planMap map[stri } } - // Check if one of the modules is RedisSearch - containsSearch := false - for _, module := range planModules { - if *module == "RediSearch" { - containsSearch = true - break - } - } - // if RediSearch is in the modules, throughput may not be operations-per-second - if containsSearch && throughputMeasurementBy == "operations-per-second" { - errDiag := diag.Diagnostic{ - Severity: diag.Error, - Summary: "subscription could not be created: throughput may not be measured by `operations-per-second` while the `RediSearch` module is active", - Detail: "throughput may not be measured by `operations-per-second` while the `RediSearch` module is active. use an alternative measurement like `number-of-shards`", - } - // Short-circuit here, this is an unrecoverable situation - return nil, append(diags, errDiag) - } - // Check if one of the modules is RedisGraph containsGraph := false for _, module := range planModules { @@ -895,6 +876,7 @@ func waitForSubscriptionToBeActive(ctx context.Context, id int, api *apiClient) Pending: []string{subscriptions.SubscriptionStatusPending}, Target: []string{subscriptions.SubscriptionStatusActive}, Timeout: safetyTimeout, + Delay: 10 * time.Second, PollInterval: 30 * time.Second, Refresh: func() (result interface{}, state string, err error) { @@ -920,6 +902,7 @@ func waitForSubscriptionToBeDeleted(ctx context.Context, id int, api *apiClient) Pending: []string{subscriptions.SubscriptionStatusDeleting}, Target: []string{"deleted"}, Timeout: safetyTimeout, + Delay: 10 * time.Second, PollInterval: 30 * time.Second, Refresh: func() (result interface{}, state string, err error) { @@ -958,6 +941,7 @@ func waitForDatabaseToBeActive(ctx context.Context, subId, id int, api *apiClien }, Target: []string{databases.StatusActive}, Timeout: safetyTimeout, + Delay: 10 * time.Second, PollInterval: 30 * time.Second, Refresh: func() (result interface{}, state string, err error) { diff --git a/provider/resource_rediscloud_pro_subscription_test.go b/provider/resource_rediscloud_pro_subscription_test.go index 628ae78f..65e44b6a 100644 --- a/provider/resource_rediscloud_pro_subscription_test.go +++ b/provider/resource_rediscloud_pro_subscription_test.go @@ -222,23 +222,6 @@ func TestAccResourceRedisCloudProSubscription_createUpdateMarketplacePayment(t * }) } -func TestAccResourceRedisCloudProSubscription_SearchModuleIncompatibleWithOperationsPerSecond(t *testing.T) { - name := acctest.RandomWithPrefix(testResourcePrefix) - testCloudAccountName := os.Getenv("AWS_TEST_CLOUD_ACCOUNT_NAME") - - resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccAwsPreExistingCloudAccountPreCheck(t) }, - ProviderFactories: providerFactories, - CheckDestroy: testAccCheckProSubscriptionDestroy, - Steps: []resource.TestStep{ - { - Config: fmt.Sprintf(testAccResourceRedisCloudProSubscriptionWithSearch, testCloudAccountName, name), - ExpectError: regexp.MustCompile("subscription could not be created: throughput may not be measured by `operations-per-second` while the `RediSearch` module is active"), - }, - }, - }) -} - func TestAccResourceRedisCloudProSubscription_RedisVersion(t *testing.T) { name := acctest.RandomWithPrefix(testResourcePrefix) testCloudAccountName := os.Getenv("AWS_TEST_CLOUD_ACCOUNT_NAME") @@ -755,50 +738,6 @@ resource "rediscloud_subscription" "example" { } ` -const testAccResourceRedisCloudProSubscriptionWithSearch = ` -data "rediscloud_payment_method" "card" { - card_type = "Visa" -} - -data "rediscloud_cloud_account" "account" { - exclude_internal_account = true - provider_type = "AWS" - name = "%s" -} - -resource "rediscloud_subscription" "example" { - - name = "%s" - payment_method_id = data.rediscloud_payment_method.card.id - memory_storage = "ram" - - allowlist { - cidrs = ["192.168.0.0/16"] - security_group_ids = [] - } - - 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 - support_oss_cluster_api=false - throughput_measurement_by = "operations-per-second" - throughput_measurement_value = 10000 - modules = ["RedisJSON", "RedisBloom", "RediSearch"] - } -} -` - const testAccResourceRedisCloudProSubscriptionWithRedisVersion = ` data "rediscloud_payment_method" "card" { card_type = "Visa"