Skip to content

Commit

Permalink
allow setting single-az with multiple nodes
Browse files Browse the repository at this point in the history
Signed-off-by: Scott Cabrinha <scott@internaught.io>
  • Loading branch information
Scott Cabrinha committed Apr 23, 2021
1 parent 52509f7 commit bb5a7e0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ resource "aws_elasticache_cluster" "default" {
maintenance_window = var.maintenance_window
notification_topic_arn = var.notification_topic_arn
port = var.port
az_mode = var.cluster_size == 1 ? "single-az" : "cross-az"
preferred_availability_zones = [for n in range(0, var.cluster_size) : element(var.availability_zones, n)]
az_mode = var.az_mode
preferred_availability_zones = var.availability_zones
tags = module.this.tags
}

Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ variable "availability_zones" {
description = "List of Availability Zones for the cluster"
}

variable "az_mode" {
type = string
default = "single-az"
description = "Enable or disable multiple AZs, eg: single-az or cross-az"
}

variable "zone_id" {
type = string
default = ""
Expand Down

0 comments on commit bb5a7e0

Please sign in to comment.