diff --git a/postgres/README.md b/postgres/README.md
index 069b962..cc3e08d 100644
--- a/postgres/README.md
+++ b/postgres/README.md
@@ -36,6 +36,7 @@ No modules.
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
+| [backup](#input\_backup) | Switch to enable backups | `bool` | `true` | no |
| [db-size](#input\_db-size) | DB size/type | `string` | `"db-f1-micro"` | no |
| [db-version](#input\_db-version) | DB type and version (e.g. POSTGRES\_14) | `string` | `"POSTGRES_14"` | no |
| [deletion-protection](#input\_deletion-protection) | Delete protection of DB | `bool` | `true` | no |
diff --git a/postgres/main.tf b/postgres/main.tf
index d4ceec4..8095a08 100644
--- a/postgres/main.tf
+++ b/postgres/main.tf
@@ -20,6 +20,13 @@ resource "google_sql_database_instance" "this" {
private_network = var.network-id
}
}
+ dynamic "backup_configuration" {
+ for_each = var.backup ? [1] : []
+ content {
+ enabled = true
+ point_in_time_recovery_enabled = true
+ }
+ }
}
depends_on = [google_service_networking_connection.this]
}
diff --git a/postgres/variables.tf b/postgres/variables.tf
index 607813a..94ba803 100644
--- a/postgres/variables.tf
+++ b/postgres/variables.tf
@@ -1,3 +1,9 @@
+variable "backup" {
+ default = true
+ description = "Switch to enable backups"
+ type = bool
+}
+
variable "db-size" {
default = "db-f1-micro"
description = "DB size/type"