From 25316fee8a9f46a69f0e31f6fc07c41b91951b5b Mon Sep 17 00:00:00 2001 From: Eric Luria Date: Thu, 6 Jun 2024 11:25:21 -0400 Subject: [PATCH] Move default attribute values into variable definition --- main.tf | 8 ++++---- variables.tf | 12 ++++-------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/main.tf b/main.tf index 994b7899..d7262009 100644 --- a/main.tf +++ b/main.tf @@ -152,10 +152,10 @@ resource "aws_rds_cluster" "primary" { dynamic "restore_to_point_in_time" { for_each = var.restore_to_point_in_time content { - source_cluster_identifier = lookup(restore_to_point_in_time.value, "source_cluster_identifier", "120m") - restore_type = lookup(restore_to_point_in_time.value, "restore_type", "copy-on-write") - use_latest_restorable_time = lookup(restore_to_point_in_time.value, "use_latest_restorable_time", true) - restore_to_time = lookup(restore_to_point_in_time.value, "restore_to_time", null) + source_cluster_identifier = restore_to_point_in_time.value.source_cluster_identifier + restore_type = restore_to_point_in_time.value.restore_type + use_latest_restorable_time = restore_to_point_in_time.value.use_latest_restorable_time + restore_to_time = restore_to_point_in_time.value.restore_to_time } } diff --git a/variables.tf b/variables.tf index 59ba55fb..b6a7ea7f 100644 --- a/variables.tf +++ b/variables.tf @@ -197,10 +197,10 @@ variable "timeouts_configuration" { variable "restore_to_point_in_time" { type = list(object({ - source_cluster_identifier = string - restore_type = string - use_latest_restorable_time = bool - restore_to_time = string + source_cluster_identifier = optional(string, "120m") + restore_type = optional(string, "copy-on-write") + use_latest_restorable_time = optional(bool, true) + restore_to_time = optional(string, null) })) default = [] description = <<-EOT @@ -208,16 +208,12 @@ variable "restore_to_point_in_time" { `source_cluster_identifier` Identifier of the source database cluster from which to restore. - default: "120m" `restore_type`: Type of restore to be performed. Valid options are "full-copy" and "copy-on-write". - default: "copy-on-write" `use_latest_restorable_time`: Set to true to restore the database cluster to the latest restorable backup time. Conflicts with `restore_to_time`. - default: true `restore_to_time`: Date and time in UTC format to restore the database cluster to. Conflicts with `use_latest_restorable_time`. - default: null EOT }