Skip to content

Commit

Permalink
feat(TPG >=5.33)!: zone_distribution_config force recreation (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
lanandra authored Jul 16, 2024
1 parent d152655 commit c49bdbf
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
2 changes: 2 additions & 0 deletions modules/redis-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ 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 |
| 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 |
| zone\_distribution\_config\_zone | The zone for single zone Memorystore Redis cluster (Immutable) | `string` | `null` | no |

## Outputs

Expand Down
8 changes: 8 additions & 0 deletions modules/redis-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ resource "google_redis_cluster" "redis_cluster" {
}
}

dynamic "zone_distribution_config" {
for_each = var.zone_distribution_config_mode != null ? [1] : []
content {
mode = var.zone_distribution_config_mode
zone = var.zone_distribution_config_mode == "SINGLE_ZONE" ? var.zone_distribution_config_zone : null
}
}

depends_on = [
google_network_connectivity_service_connection_policy.service_connection_policies,
module.enable_apis,
Expand Down
12 changes: 12 additions & 0 deletions modules/redis-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,15 @@ variable "redis_configs" {
})
default = null
}

variable "zone_distribution_config_mode" {
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"
type = string
default = "MULTI_ZONE"
}

variable "zone_distribution_config_zone" {
description = "The zone for single zone Memorystore Redis cluster (Immutable)"
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.28, < 6"
version = ">= 5.33, < 6"
}
google-beta = {
source = "hashicorp/google-beta"
version = ">= 5.28, < 6"
version = ">= 5.33, < 6"
}
}

Expand Down

0 comments on commit c49bdbf

Please sign in to comment.