Skip to content

Commit 52498f2

Browse files
authored
chore: update Elasticache to support new "transit_encryption_mode" option (#364)
1 parent 6dae5f3 commit 52498f2

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

aws/elasticache/elasticache.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ resource "aws_elasticache_replication_group" "non_cluster_mode" {
1212
subnet_group_name = aws_elasticache_subnet_group.main.name
1313
at_rest_encryption_enabled = true
1414
transit_encryption_enabled = var.transit_encryption_enabled # we should not allow setting this to false, but we have legacy apps that need to be upgraded
15+
transit_encryption_mode = var.transit_encryption_mode
1516
kms_key_id = var.kms_key_arn
1617
snapshot_retention_limit = var.snapshot_retention_limit
1718
# When you change an attribute, such as engine_version,
@@ -55,6 +56,7 @@ resource "aws_elasticache_replication_group" "cluster_mode" {
5556
subnet_group_name = aws_elasticache_subnet_group.main.name
5657
at_rest_encryption_enabled = true
5758
transit_encryption_enabled = var.transit_encryption_enabled # we should not allow setting this to false, but we have legacy apps that need to be upgraded
59+
transit_encryption_mode = var.transit_encryption_mode
5860
kms_key_id = var.kms_key_arn
5961
snapshot_retention_limit = var.snapshot_retention_limit
6062
apply_immediately = true

aws/elasticache/variables.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,17 @@ variable "transit_encryption_enabled" {
8181
description = ":warning: changing this from `false` to `true` requires a re-creation of the cluster"
8282
}
8383

84+
variable "transit_encryption_mode" {
85+
type = string
86+
default = "required"
87+
description = "when migrating from no encryption to encryption, this must be set to 'preferred', then apply changes, then set to 'required'"
88+
validation {
89+
condition = contains(["required", "preferred"], var.transit_encryption_mode)
90+
error_message = "transit_encryption_mode must be either 'required' or 'preferred'"
91+
92+
}
93+
}
94+
8495
variable "multi_az_enabled" {
8596
type = bool
8697
default = true

0 commit comments

Comments
 (0)