Skip to content

Commit a7def45

Browse files
authored
fix(aws, stack): elasticache_transit_encryption_mode (#366)
* fix(aws, stack): elasticache_transit_encryption_mode * fix: allow null for transit encryption mode * fix: allow null * stack: default to null * Update variables.tf * make nullable * not nullable? * do not use buggy contains
1 parent 0c6ebe0 commit a7def45

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

aws/elasticache/variables.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,11 @@ variable "transit_encryption_enabled" {
8484
variable "transit_encryption_mode" {
8585
type = string
8686
default = "required"
87+
nullable = true
8788
description = "when migrating from no encryption to encryption, this must be set to 'preferred', then apply changes, then set to 'required'"
8889

8990
validation {
90-
condition = contains(["required", "preferred"], var.transit_encryption_mode)
91+
condition = var.transit_encryption_mode == null || var.transit_encryption_mode == "required" || var.transit_encryption_mode == "preferred"
9192
error_message = "transit_encryption_mode must be either 'required' or 'preferred'"
9293
}
9394
}
@@ -116,6 +117,7 @@ variable "maxmemory_policy" {
116117
type = string
117118
default = null
118119
description = "Only effective, when NOT passing a custom parameter group name"
120+
119121
validation {
120122
condition = var.maxmemory_policy == null || contains(["volatile-lru", "allkeys-lru", "volatile-lfu", "allkeys-lfu", "volatile-random", "allkeys-random", "volatile-ttl", "noeviction"], var.maxmemory_policy)
121123
error_message = "maxmemory_policy must be one of volatile-lru, allkeys-lru, volatile-lfu, allkeys-lfu, volatile-random, allkeys-random, volatile-ttl, noeviction"

aws/stack/app/elasticache.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ module "elasticache" {
2929
cluster_mode = var.elasticache_cluster_mode
3030
maxmemory_policy = var.elasticache_maxmemory_policy == null ? (var.elasticache_cluster_mode ? "volatile-lru" : "noeviction") : var.elasticache_maxmemory_policy
3131
transit_encryption_enabled = var.elasticache_transit_encryption_enabled
32+
transit_encryption_mode = var.elasticache_transit_encryption_mode
3233
}

aws/stack/app/variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,18 @@ variable "rds_ca_cert_identifier" {
397397
# =============== ECS ================ #
398398
variable "health_check_path" { default = "/livez" }
399399

400+
variable "elasticache_transit_encryption_mode" {
401+
type = string
402+
default = null
403+
nullable = true
404+
description = "when migrating from no encryption to encryption, this must be set to 'preferred', then apply changes, then set to 'required'"
405+
406+
validation {
407+
condition = var.elasticache_transit_encryption_mode == null || var.elasticache_transit_encryption_mode == "required" || var.elasticache_transit_encryption_mode == "preferred"
408+
error_message = "elasticache_transit_encryption_mode must be either 'required' or 'preferred'"
409+
}
410+
}
411+
400412
variable "enable_container_insights" {
401413
type = bool
402414
default = null

0 commit comments

Comments
 (0)