Skip to content

Commit

Permalink
Fix/ensure-only-central-backup-is-used (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
samidbb authored Dec 18, 2023
1 parent 2349e69 commit 643bab2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ Terraform module for AWS RDS instances
| <a name="input_apply_immediately"></a> [apply\_immediately](#input\_apply\_immediately) | Specifies whether any database modifications are applied immediately, or during the next maintenance window | `bool` | `false` | no |
| <a name="input_auto_minor_version_upgrade"></a> [auto\_minor\_version\_upgrade](#input\_auto\_minor\_version\_upgrade) | Indicates that minor engine upgrades will be applied automatically to the DB instance during the maintenance window | `bool` | `true` | no |
| <a name="input_availability_zone"></a> [availability\_zone](#input\_availability\_zone) | The Availability Zone of the RDS instance | `string` | `null` | no |
| <a name="input_backup_retention_period"></a> [backup\_retention\_period](#input\_backup\_retention\_period) | The days to retain backups for | `number` | `null` | no |
| <a name="input_backup_window"></a> [backup\_window](#input\_backup\_window) | The daily time range (in UTC) during which automated backups are created if they are enabled. Example: '09:46-10:16'. Must not overlap with maintenance\_window | `string` | `null` | no |
| <a name="input_blue_green_update"></a> [blue\_green\_update](#input\_blue\_green\_update) | Enables low-downtime updates using RDS Blue/Green deployments. | `map(string)` | `{}` | no |
| <a name="input_ca_cert_identifier"></a> [ca\_cert\_identifier](#input\_ca\_cert\_identifier) | Specifies the identifier of the CA certificate for the DB instance | `string` | `null` | no |
| <a name="input_character_set_name"></a> [character\_set\_name](#input\_character\_set\_name) | The character set name to use for DB encoding in Oracle instances. This can't be changed. See Oracle Character Sets Supported in Amazon RDS and Collations and Character Sets for Microsoft SQL Server for more information. This can only be set on creation | `string` | `null` | no |
Expand Down
3 changes: 2 additions & 1 deletion locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ locals {
performance_insights_enabled = var.performance_insights_enabled != null ? var.performance_insights_enabled : local.default_config.performance_insights_enabled
performance_insights_retention_period = var.performance_insights_retention_period != null ? var.performance_insights_retention_period : local.default_config.performance_insights_retention_period
delete_automated_backups = var.delete_automated_backups != null ? var.delete_automated_backups : local.default_config.delete_automated_backups
backup_retention_period = var.backup_retention_period != null ? var.backup_retention_period : 0
backup_retention_period = null
backup_window = null

########################################################################
# Tagging
Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ module "db_instance" {
performance_insights_enabled = local.performance_insights_enabled
performance_insights_retention_period = local.performance_insights_retention_period
backup_retention_period = local.backup_retention_period
backup_window = var.backup_window
backup_window = local.backup_window
monitoring_interval = var.enhanced_monitoring_interval
monitoring_role_arn = local.monitoring_role_arn
timeouts = var.timeouts
Expand Down
16 changes: 4 additions & 12 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,10 @@ variable "maintenance_window" { # TODO: Need validation. Use regex?
description = "The window to perform maintenance in. Syntax: 'ddd:hh24:mi-ddd:hh24:mi'. Eg: 'Mon:00:00-Mon:03:00'"
type = string
default = "Sat:18:00-Sat:20:00" # This is adjusted in accordance with AWS Backup schedule, see info here: https://wiki.dfds.cloud/en/playbooks/aws-backup/aws-backup-getting-started
validation {
condition = can(regex("^([a-zA-Z]{3}):([0-2][0-9]):([0-5][0-9])-([a-zA-Z]{3}):([0-2][0-9]):([0-5][0-9])$", var.maintenance_window))
error_message = "Maintenance window must be in the format 'ddd:hh24:mi-ddd:hh24:mi'. Eg: 'Mon:00:00-Mon:03:00'"
}
}
# Continuous backup takes place between 8 PM and 5 AM UTC.
# Snapshot backups take place between 3 AM and 7 AM UTC.
Expand All @@ -283,18 +287,6 @@ variable "blue_green_update" {
default = {}
}

variable "backup_retention_period" { # TODO: Delete
description = "The days to retain backups for"
type = number
default = null
}

variable "backup_window" { # TODO: Delete
description = "The daily time range (in UTC) during which automated backups are created if they are enabled. Example: '09:46-10:16'. Must not overlap with maintenance_window"
type = string
default = null
}

variable "restore_to_point_in_time" {
description = "Restore to a point in time (MySQL is NOT supported)"
type = map(string)
Expand Down

0 comments on commit 643bab2

Please sign in to comment.