Skip to content

Commit c49bdbf

Browse files
authored
feat(TPG >=5.33)!: zone_distribution_config force recreation (#222)
1 parent d152655 commit c49bdbf

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

modules/redis-cluster/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ module "redis_cluster" {
4242
| 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 |
4343
| 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 |
4444
| 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 |
45+
| zone\_distribution\_config\_mode | The mode for zone distribution for Memorystore Redis cluster (Immutable). If not provided, MULTI\_ZONE will be used as default value. Possible values are: MULTI\_ZONE, SINGLE\_ZONE | `string` | `"MULTI_ZONE"` | no |
46+
| zone\_distribution\_config\_zone | The zone for single zone Memorystore Redis cluster (Immutable) | `string` | `null` | no |
4547

4648
## Outputs
4749

modules/redis-cluster/main.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ resource "google_redis_cluster" "redis_cluster" {
3232
}
3333
}
3434

35+
dynamic "zone_distribution_config" {
36+
for_each = var.zone_distribution_config_mode != null ? [1] : []
37+
content {
38+
mode = var.zone_distribution_config_mode
39+
zone = var.zone_distribution_config_mode == "SINGLE_ZONE" ? var.zone_distribution_config_zone : null
40+
}
41+
}
42+
3543
depends_on = [
3644
google_network_connectivity_service_connection_policy.service_connection_policies,
3745
module.enable_apis,

modules/redis-cluster/variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,15 @@ variable "redis_configs" {
9696
})
9797
default = null
9898
}
99+
100+
variable "zone_distribution_config_mode" {
101+
description = "The mode for zone distribution for Memorystore Redis cluster (Immutable). If not provided, MULTI_ZONE will be used as default value. Possible values are: MULTI_ZONE, SINGLE_ZONE"
102+
type = string
103+
default = "MULTI_ZONE"
104+
}
105+
106+
variable "zone_distribution_config_zone" {
107+
description = "The zone for single zone Memorystore Redis cluster (Immutable)"
108+
type = string
109+
default = null
110+
}

modules/redis-cluster/versions.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ terraform {
2020

2121
google = {
2222
source = "hashicorp/google"
23-
version = ">= 5.28, < 6"
23+
version = ">= 5.33, < 6"
2424
}
2525
google-beta = {
2626
source = "hashicorp/google-beta"
27-
version = ">= 5.28, < 6"
27+
version = ">= 5.33, < 6"
2828
}
2929
}
3030

0 commit comments

Comments
 (0)