Skip to content
This repository has been archived by the owner on Mar 29, 2023. It is now read-only.

Commit

Permalink
Add point in time recovery option in backend configuration (#50)
Browse files Browse the repository at this point in the history
* Add point in time recovery option in backend coniguration

* Fix condition
  • Loading branch information
mvoitko authored Dec 11, 2020
1 parent e258f14 commit 767e758
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 4 additions & 3 deletions modules/cloud-sql/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@ resource "google_sql_database_instance" "master" {
}

backup_configuration {
binary_log_enabled = local.actual_binary_log_enabled
enabled = var.backup_enabled
start_time = var.backup_start_time
binary_log_enabled = local.actual_binary_log_enabled
enabled = var.backup_enabled
start_time = var.backup_start_time
point_in_time_recovery_enabled = local.is_postgres ? var.postgres_point_in_time_recovery_enabled : null
}

maintenance_window {
Expand Down
6 changes: 6 additions & 0 deletions modules/cloud-sql/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ variable "backup_start_time" {
default = "04:00"
}

variable "postgres_point_in_time_recovery_enabled" {
description = "Will restart database if enabled after instance creation - only applicable to PostgreSQL"
type = bool
default = false
}

variable "mysql_binary_log_enabled" {
description = "Set to false if you want to disable binary logs - only applicable to MySQL. Note, when using failover or read replicas, master and existing backups need to have binary_log_enabled=true set."
type = bool
Expand Down

0 comments on commit 767e758

Please sign in to comment.