Skip to content

Commit

Permalink
feat(postgres): Added point_in_time_recovery_enabled backup option fo…
Browse files Browse the repository at this point in the history
…r Postgres (#142)
  • Loading branch information
jmymy committed Oct 23, 2020
1 parent 69e1911 commit 1fcae8a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
7 changes: 4 additions & 3 deletions examples/postgresql-ha/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ module "pg" {
}

backup_configuration = {
enabled = true
start_time = "20:55"
location = null
enabled = true
start_time = "20:55"
location = null
point_in_time_recovery_enabled = false
}

// Read replica configurations
Expand Down
9 changes: 5 additions & 4 deletions modules/postgresql/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@ resource "google_sql_database_instance" "default" {
dynamic "backup_configuration" {
for_each = [var.backup_configuration]
content {
binary_log_enabled = false
enabled = lookup(backup_configuration.value, "enabled", null)
start_time = lookup(backup_configuration.value, "start_time", null)
location = lookup(backup_configuration.value, "location", null)
binary_log_enabled = false
enabled = lookup(backup_configuration.value, "enabled", null)
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)
}
}
dynamic "ip_configuration" {
Expand Down
14 changes: 8 additions & 6 deletions modules/postgresql/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,16 @@ variable "user_labels" {
variable "backup_configuration" {
description = "The backup_configuration settings subblock for the database setings"
type = object({
enabled = bool
start_time = string
location = string
enabled = bool
start_time = string
location = string
point_in_time_recovery_enabled = bool
})
default = {
enabled = false
start_time = null
location = null
enabled = false
start_time = null
location = null
point_in_time_recovery_enabled = false
}
}

Expand Down

0 comments on commit 1fcae8a

Please sign in to comment.