Skip to content

Commit

Permalink
Move default attribute values into variable definition
Browse files Browse the repository at this point in the history
  • Loading branch information
ericluria committed Jun 6, 2024
1 parent 0fa6725 commit 25316fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
8 changes: 4 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
12 changes: 4 additions & 8 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -197,27 +197,23 @@ 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
List of point-in-time recovery options. Valid parameters are:
`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
}

Expand Down

0 comments on commit 25316fe

Please sign in to comment.