Skip to content

Commit

Permalink
Add HA switch
Browse files Browse the repository at this point in the history
  • Loading branch information
wawrzek committed Oct 17, 2024
1 parent faa4a07 commit a0cfa1d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions postgres/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ No modules.

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_availability"></a> [availability](#input\_availability) | Type of availability (normal=ZONAL, HA=REGIONAL) | `string` | `"ZONAL"` | no |
| <a name="input_backup"></a> [backup](#input\_backup) | Switch to enable backups | `bool` | `true` | no |
| <a name="input_db-size"></a> [db-size](#input\_db-size) | DB size/type | `string` | `"db-f1-micro"` | no |
| <a name="input_db-version"></a> [db-version](#input\_db-version) | DB type and version (e.g. POSTGRES\_14) | `string` | `"POSTGRES_14"` | no |
Expand Down
1 change: 1 addition & 0 deletions postgres/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ resource "google_sql_database_instance" "this" {
point_in_time_recovery_enabled = true
}
}
availability_type = var.availability
}
depends_on = [google_service_networking_connection.this]
}
Expand Down
10 changes: 10 additions & 0 deletions postgres/variables.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
variable "availability" {
default = "ZONAL"
description = "Type of availability (normal=ZONAL, HA=REGIONAL)"
type = string
validation {
condition = contains(["ZONAL", "REGIONAL"], var.availability)
error_message = "It has to be 'ZONAL' or 'REGIONAL'"
}
}

variable "backup" {
default = true
description = "Switch to enable backups"
Expand Down

0 comments on commit a0cfa1d

Please sign in to comment.