diff --git a/aws/rds/rds.tf b/aws/rds/rds.tf index 4b8b52d2b..e121aeb96 100644 --- a/aws/rds/rds.tf +++ b/aws/rds/rds.tf @@ -147,6 +147,9 @@ resource "aws_rds_cluster" "notification-canada-ca" { preferred_backup_window = "07:00-09:00" preferred_maintenance_window = "wed:04:00-wed:04:30" db_subnet_group_name = aws_db_subnet_group.notification-canada-ca.name + + snapshot_identifier = var.recovery == true ? var.rds_snapshot_identifier : null + #tfsec:ignore:AWS051 - database is encrypted without a custom key and that's fine storage_encrypted = true deletion_protection = var.enable_delete_protection diff --git a/aws/rds/variables.tf b/aws/rds/variables.tf index 86028dbac..d4af1a564 100644 --- a/aws/rds/variables.tf +++ b/aws/rds/variables.tf @@ -65,4 +65,15 @@ variable "rds_version" { type = string description = "The version of the RDS instance." default = "15.5" +} + +variable "recovery" { + type = bool + description = "Set to true if you want to recover from a snapshot." + default = false +} + +variable "rds_snapshot_identifier" { + type = string + description = "The snapshot identifier to recover from." } \ No newline at end of file