Skip to content

Commit 77f0189

Browse files
committed
Set auth_token_update_strategy to ROTATE by default if auth_token is not null, null otherwise
1 parent d6cf97a commit 77f0189

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

main.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ locals {
66
"${module.label.id}-000${i + 1}-00${j + 1}"
77
]
88
]) : [module.label.id]
9+
10+
auth_token_update_strategy = var.auth_token_update_strategy != null ? var.auth_token_update_strategy : var.auth_token != null ? "ROTATE" : null
911
}
1012

1113
module "label" {
@@ -186,7 +188,7 @@ resource "aws_elasticache_replication_group" "default" {
186188
apply_immediately = var.apply_immediately
187189
data_tiering_enabled = var.data_tiering_enabled
188190
auto_minor_version_upgrade = var.auto_minor_version_upgrade
189-
auth_token_update_strategy = var.auth_token_update_strategy
191+
auth_token_update_strategy = local.auth_token_update_strategy
190192

191193
dynamic "log_delivery_configuration" {
192194
for_each = var.log_delivery_configuration

variables.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,10 @@ variable "insufficient_data_actions" {
282282
variable "auth_token_update_strategy" {
283283
description = "Strategy to use when updating the auth_token. Valid values: SET, ROTATE, DELETE."
284284
type = string
285-
default = "ROTATE"
285+
default = null
286286

287287
validation {
288-
condition = contains(["SET", "ROTATE", "DELETE"], var.auth_token_update_strategy)
289-
error_message = "auth_token_update_strategy must be one of SET, ROTATE, or DELETE if auth_token is set."
288+
condition = contains(["SET", "ROTATE", "DELETE", null], var.auth_token_update_strategy)
289+
error_message = "auth_token_update_strategy must be one of SET, ROTATE, DELETE, or null"
290290
}
291291
}

0 commit comments

Comments
 (0)