feat(cloudsql-instance): add retain_backups_on_delete and final_backup_config support
- Add retain_backups_on_delete setting to allow backups to be retained when instance is deleted - Add final_backup_config with enabled flag and retention_days configuration - Both settings default to disabled/null for backward compatibility - Prevents accidental loss of backups through Terraform operations
This commit is contained in:
committed by
Wiktor Niesiobędzki
parent
c7c460e006
commit
46d71f3f8a
@@ -61,6 +61,7 @@ resource "google_sql_database_instance" "primary" {
|
||||
collation = var.collation
|
||||
connector_enforcement = var.connector_enforcement
|
||||
time_zone = var.time_zone
|
||||
retain_backups_on_delete = var.backup_configuration.retain_backups_on_delete
|
||||
|
||||
ip_configuration {
|
||||
ipv4_enabled = var.network_config.connectivity.public_ipv4
|
||||
@@ -127,6 +128,14 @@ resource "google_sql_database_instance" "primary" {
|
||||
}
|
||||
}
|
||||
|
||||
dynamic "final_backup_config" {
|
||||
for_each = var.backup_configuration.final_backup != null ? [var.backup_configuration.final_backup] : []
|
||||
content {
|
||||
enabled = final_backup_config.value.enabled
|
||||
retention_days = final_backup_config.value.retention_days
|
||||
}
|
||||
}
|
||||
|
||||
dynamic "connection_pool_config" {
|
||||
# Only available for PostgreSQL on Enterprise Plus edition.
|
||||
for_each = (var.managed_connection_pooling_config.enabled && local.is_postgres && var.edition == "ENTERPRISE_PLUS") ? [1] : []
|
||||
|
||||
Reference in New Issue
Block a user