From 183384df79426817f3771854c5470e97c45a901a Mon Sep 17 00:00:00 2001 From: Christophe BIGUEREAU Date: Thu, 30 Oct 2025 15:31:11 +0100 Subject: [PATCH] fix(mysql): Setup retained_backups base on transaction_log_retention_days --- modules/mysql/read_replica.tf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/mysql/read_replica.tf b/modules/mysql/read_replica.tf index 01995648..9c77edf8 100644 --- a/modules/mysql/read_replica.tf +++ b/modules/mysql/read_replica.tf @@ -55,6 +55,10 @@ resource "google_sql_database_instance" "replicas" { content { binary_log_enabled = lookup(backup_configuration.value, "binary_log_enabled", null) transaction_log_retention_days = lookup(backup_configuration.value, "transaction_log_retention_days", null) + backup_retention_settings { + retained_backups = lookup(backup_configuration.value, "transaction_log_retention_days", 0) > 7 ? lookup(backup_configuration.value, "transaction_log_retention_days") + 1 : null + retention_unit = "COUNT" + } } }