Skip to content

Commit

Permalink
feat(TPG >=5.24)!: Allow modifying of node type in redis cluster sub-…
Browse files Browse the repository at this point in the history
…module (#206)
  • Loading branch information
ivankennethwang authored Apr 29, 2024
1 parent 31dc3de commit f30de6f
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 2 deletions.
5 changes: 5 additions & 0 deletions docs/upgrading_to_v9.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Upgrading to v9.0.0

The v9.0 release contains backwards-incompatible changes.

This update requires upgrading the minimum provider version to `5.24`.
1 change: 1 addition & 0 deletions examples/redis-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ This test will create a new redis cluster.
| cluster\_id | The redis cluster instance ID |
| cluster\_name | The redis cluster name |
| cluster\_region | The redis cluster region |
| node\_type | The redis cluster node type |
| project\_id | The redis cluster Project ID |
| replica\_count | The redis cluster replica count |
| shard\_count | The redis cluster shard count |
Expand Down
5 changes: 5 additions & 0 deletions examples/redis-cluster/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,8 @@ output "authorization_mode" {
description = "The redis cluster authorization mode"
value = module.redis_cluster.redis_cluster.authorization_mode
}

output "node_type" {
description = "The redis cluster node type"
value = module.redis_cluster.redis_cluster.node_type
}
1 change: 1 addition & 0 deletions modules/redis-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ module "redis_cluster" {
| enable\_apis | Flag for enabling memcache.googleapis.com in your project | `bool` | `true` | no |
| name | The ID of the instance or a fully qualified identifier for the instance. must be 1 to 63 characters and use only lowercase letters, numbers, or hyphens. It must start with a lowercase letter and end with a lowercase letter or number | `string` | n/a | yes |
| network | List of consumer network where the network address of the discovery endpoint will be reserved, in the form of projects/{network\_project\_id\_or\_number}/global/networks/{network\_id}. Currently, only one item is supported | `list(string)` | n/a | yes |
| 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` | `null` | no |
| project | The ID of the project in which the resource belongs to. | `string` | n/a | yes |
| region | The name of the region of the Redis cluster | `string` | n/a | yes |
| replica\_count | The number of replica nodes per shard. Each shard can have 0, 1, or 2 replica nodes. Replicas provide high availability and additional read throughput, and are evenly distributed across zones | `number` | `0` | no |
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 = string
default = null
}
4 changes: 2 additions & 2 deletions modules/redis-cluster/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ terraform {

google = {
source = "hashicorp/google"
version = ">= 5.4, < 6"
version = ">= 5.24, < 6"
}
google-beta = {
source = "hashicorp/google-beta"
version = ">= 5.4, < 6"
version = ">= 5.24, < 6"
}
}

Expand Down
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 f30de6f

Please sign in to comment.