From b9a6ada308e4e539efba4191a6a8100926e0a4f2 Mon Sep 17 00:00:00 2001 From: pawanphalak <105412459+pawanphalak@users.noreply.github.com> Date: Wed, 5 Jun 2024 22:57:08 +0530 Subject: [PATCH] feat: Add Point in time recovery flag for mysql DB (#607) --- modules/mysql/README.md | 2 +- modules/mysql/main.tf | 1 + modules/mysql/variables.tf | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/mysql/README.md b/modules/mysql/README.md index 56d6c5a4..832ce469 100644 --- a/modules/mysql/README.md +++ b/modules/mysql/README.md @@ -11,7 +11,7 @@ Note: CloudSQL provides [disk autoresize](https://cloud.google.com/sql/docs/mysq | additional\_databases | A list of databases to be created in your cluster |
list(object({
name = string
charset = string
collation = string
}))
| `[]` | no | | additional\_users | A list of users to be created in your cluster. A random password would be set for the user if the `random_password` variable is set. |
list(object({
name = string
password = string
random_password = bool
type = string
host = string
}))
| `[]` | no | | availability\_type | The availability type for the master instance. Can be either `REGIONAL` or `null`. | `string` | `"REGIONAL"` | no | -| backup\_configuration | The backup\_configuration settings subblock for the database setings |
object({
binary_log_enabled = optional(bool, false)
enabled = optional(bool, false)
start_time = optional(string)
location = optional(string)
transaction_log_retention_days = optional(string)
retained_backups = optional(number)
retention_unit = optional(string)
})
| `{}` | no | +| backup\_configuration | The backup\_configuration settings subblock for the database setings |
object({
binary_log_enabled = optional(bool, false)
enabled = optional(bool, false)
start_time = optional(string)
location = optional(string)
point_in_time_recovery_enabled = optional(bool, false)
transaction_log_retention_days = optional(string)
retained_backups = optional(number)
retention_unit = optional(string)
})
| `{}` | no | | connector\_enforcement | Enforce that clients use the connector library | `bool` | `false` | no | | create\_timeout | The optional timout that is applied to limit long database creates. | `string` | `"30m"` | no | | data\_cache\_enabled | Whether data cache is enabled for the instance. Defaults to false. Feature is only available for ENTERPRISE\_PLUS tier and supported database\_versions | `bool` | `false` | no | diff --git a/modules/mysql/main.tf b/modules/mysql/main.tf index 457d02fe..4a100a7c 100644 --- a/modules/mysql/main.tf +++ b/modules/mysql/main.tf @@ -76,6 +76,7 @@ resource "google_sql_database_instance" "default" { enabled = local.backups_enabled && var.master_instance_name == null ? true : false start_time = lookup(backup_configuration.value, "start_time", null) location = lookup(backup_configuration.value, "location", null) + point_in_time_recovery_enabled = lookup(backup_configuration.value, "point_in_time_recovery_enabled", false) transaction_log_retention_days = lookup(backup_configuration.value, "transaction_log_retention_days", null) dynamic "backup_retention_settings" { diff --git a/modules/mysql/variables.tf b/modules/mysql/variables.tf index e6af826f..68338b4e 100644 --- a/modules/mysql/variables.tf +++ b/modules/mysql/variables.tf @@ -205,6 +205,7 @@ variable "backup_configuration" { enabled = optional(bool, false) start_time = optional(string) location = optional(string) + point_in_time_recovery_enabled = optional(bool, false) transaction_log_retention_days = optional(string) retained_backups = optional(number) retention_unit = optional(string)