Skip to content

Commit

Permalink
Updated docs, reintroduced some very short delays before Waiting and …
Browse files Browse the repository at this point in the history
…removed redisearch/throughput validation
  • Loading branch information
JohnSharpe committed Aug 27, 2024
1 parent 2d7e7d5 commit 620310c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 83 deletions.
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion docs/resources/rediscloud_subscription_database.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
22 changes: 3 additions & 19 deletions provider/resource_rediscloud_pro_subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
61 changes: 0 additions & 61 deletions provider/resource_rediscloud_pro_subscription_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 620310c

Please sign in to comment.