From 1bc3f9e7454863976870e8669b2b9d0ac7916846 Mon Sep 17 00:00:00 2001 From: Ivan Kenneth Wang Date: Tue, 16 Apr 2024 11:36:50 +0200 Subject: [PATCH] feat: Allow modifying of node type (#205) --- modules/redis-cluster/README.md | 1 + modules/redis-cluster/main.tf | 1 + modules/redis-cluster/variables.tf | 6 ++++++ test/integration/redis-cluster/redis_cluster_test.go | 2 ++ 4 files changed, 10 insertions(+) diff --git a/modules/redis-cluster/README.md b/modules/redis-cluster/README.md index 4228ca0a..56cf043a 100644 --- a/modules/redis-cluster/README.md +++ b/modules/redis-cluster/README.md @@ -45,6 +45,7 @@ module "redis_cluster" { | service\_connection\_policies | The Service Connection Policies to create |
map(object({
description = optional(string)
network_name = string
network_project = string
subnet_names = list(string)
limit = optional(number)
labels = optional(map(string), {})
}))
| `{}` | no | | shard\_count | Required. Number of shards for the Redis cluster. The minimum number of shards in a Memorystore cluster is 3 shards | `number` | `3` | no | | transit\_encryption\_mode | The in-transit encryption for the Redis cluster. If not provided, encryption is disabled for the cluster. Default value is TRANSIT\_ENCRYPTION\_MODE\_DISABLED. Possible values are: TRANSIT\_ENCRYPTION\_MODE\_UNSPECIFIED, TRANSIT\_ENCRYPTION\_MODE\_DISABLED, TRANSIT\_ENCRYPTION\_MODE\_SERVER\_AUTHENTICATION | `string` | `"TRANSIT_ENCRYPTION_MODE_DISABLED"` | no | +| node\_type | The nodeType for the Redis cluster. If not provided, REDIS\_HIGHMEM\_MEDIUM will be used as default Possible values are: REDIS\_SHARED\_CORE\_NANO, REDIS\_HIGHMEM\_MEDIUM, REDIS\_HIGHMEM\_XLARGE, REDIS\_STANDARD\_SMALL. | `string` | `"REDIS_HIGHMEM_MEDIUM"` | no | ## Outputs diff --git a/modules/redis-cluster/main.tf b/modules/redis-cluster/main.tf index e68743ff..35205812 100644 --- a/modules/redis-cluster/main.tf +++ b/modules/redis-cluster/main.tf @@ -22,6 +22,7 @@ resource "google_redis_cluster" "redis_cluster" { replica_count = var.replica_count transit_encryption_mode = var.transit_encryption_mode authorization_mode = var.authorization_mode + node_type = var.node_type dynamic "psc_configs" { for_each = var.network diff --git a/modules/redis-cluster/variables.tf b/modules/redis-cluster/variables.tf index ad62ff2b..2b1e4223 100644 --- a/modules/redis-cluster/variables.tf +++ b/modules/redis-cluster/variables.tf @@ -77,3 +77,9 @@ variable "service_connection_policies" { })) default = {} } + +variable "node_type" { + description = "The nodeType for the Redis cluster. If not provided, REDIS_HIGHMEM_MEDIUM will be used as default Possible values are: REDIS_SHARED_CORE_NANO, REDIS_HIGHMEM_MEDIUM, REDIS_HIGHMEM_XLARGE, REDIS_STANDARD_SMALL." + type = optional(string) + default = "REDIS_HIGHMEM_MEDIUM" +} diff --git a/test/integration/redis-cluster/redis_cluster_test.go b/test/integration/redis-cluster/redis_cluster_test.go index 48cbcf54..31db7a64 100755 --- a/test/integration/redis-cluster/redis_cluster_test.go +++ b/test/integration/redis-cluster/redis_cluster_test.go @@ -36,6 +36,7 @@ func TestRedisCluster(t *testing.T) { transitEncryptionMode := rc.GetStringOutput("transit_encryption_mode") replicaCount := rc.GetStringOutput("replica_count") authorizationMode := rc.GetStringOutput("authorization_mode") + nodeType := rc.GetStringOutput("node_type") op := gcloud.Runf(t, "redis clusters describe %s --project %s --region %s",clusterName, projectId, clusterRegion) @@ -44,6 +45,7 @@ func TestRedisCluster(t *testing.T) { assert.Equal(op.Get("transitEncryptionMode").String(), transitEncryptionMode) assert.Equal(op.Get("replicaCount").String(), replicaCount) assert.Equal(op.Get("authorizationMode").String(), authorizationMode) + assert.Equal(op.Get("nodeType").String(), nodeType) }) rc.Test()