Skip to content

Commit

Permalink
feat: Allow modifying of node type (#205)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankennethwang committed Apr 16, 2024
1 parent e893e48 commit 1bc3f9e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/redis-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ module "redis_cluster" {
| service\_connection\_policies | The Service Connection Policies to create | <pre>map(object({<br> description = optional(string)<br> network_name = string<br> network_project = string<br> subnet_names = list(string)<br> limit = optional(number)<br> labels = optional(map(string), {})<br> }))</pre> | `{}` | 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

Expand Down
1 change: 1 addition & 0 deletions modules/redis-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions modules/redis-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
2 changes: 2 additions & 0 deletions test/integration/redis-cluster/redis_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
Expand Down

0 comments on commit 1bc3f9e

Please sign in to comment.