Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Allow configuring transit_encryption_mode #231

Merged
merged 10 commits into from
Jun 14, 2024
6 changes: 2 additions & 4 deletions examples/complete/fixtures.us-east-2.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@ instance_type = "cache.m6g.large"

cluster_size = 1

family = "redis6.x"
family = "redis7"

engine_version = "6.x"
engine_version = "7.2"
nitrocode marked this conversation as resolved.
Show resolved Hide resolved

at_rest_encryption_enabled = false

transit_encryption_enabled = true

zone_id = "Z3SO0TKDDQ0RGG"

cloudwatch_metric_alarms_enabled = false
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ resource "aws_elasticache_replication_group" "default" {
engine_version = var.engine_version
at_rest_encryption_enabled = var.at_rest_encryption_enabled
transit_encryption_enabled = var.transit_encryption_enabled
transit_encryption_mode = var.transit_encryption_mode
kms_key_id = var.at_rest_encryption_enabled ? var.kms_key_id : null
snapshot_name = var.snapshot_name
snapshot_arns = var.snapshot_arns
Expand Down
13 changes: 13 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,19 @@ variable "transit_encryption_enabled" {
EOT
}

variable "transit_encryption_mode" {
type = string
default = "preferred"
description = <<-EOT
A setting that enables clients to migrate to in-transit encryption with no downtime. Valid values are `preferred` and `required`. When enabling encryption on an existing replication group, this must first be set to `preferred` before setting it to `required` in a subsequent apply. See the TransitEncryptionMode field in the [CreateReplicationGroup](https://docs.aws.amazon.com/AmazonElastiCache/latest/APIReference/API_CreateReplicationGroup.html) API documentation for additional details."
EOT

validation {
condition = lower(var.transit_encryption_mode) == "preferred" || lower(var.transit_encryption_mode) == "required"
error_message = "The transit_encryption_mode must be either `preferred` (Default) or `required`"
}
}

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