Skip to content

Commit 57340c6

Browse files
feat: Enable high postgres high availability (#260)
1 parent cf9b447 commit 57340c6

File tree

5 files changed

+62
-10
lines changed

5 files changed

+62
-10
lines changed

infrastructure/modules/app-insights/alerts.tf

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
resource "azurerm_monitor_metric_alert" "exceptions" {
22
count = var.enable_alerting ? 1 : 0
33

4-
auto_mitigate = true
5-
description = "Triggered by any Exception"
6-
enabled = true
7-
frequency = var.alert_frequency
8-
name = "${var.name}-exceptions-alert"
9-
resource_group_name = var.resource_group_name
10-
scopes = [azurerm_application_insights.appins.id]
11-
severity = 1
12-
window_size = local.alert_window_size
4+
auto_mitigate = true
5+
description = "Triggered by any Exception"
6+
enabled = true
7+
frequency = var.alert_frequency
8+
name = "${var.name}-exceptions-alert"
9+
resource_group_name = var.resource_group_name
10+
scopes = [azurerm_application_insights.appins.id]
11+
severity = 1
12+
window_size = local.alert_window_size
1313

1414
action {
15-
action_group_id = var.action_group_id
15+
action_group_id = var.action_group_id
1616
}
1717

1818
criteria {

infrastructure/modules/application-gateway/tfdocs.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ map(object({
143143
backend_http_settings_key = string
144144
http_listener_key = string
145145
priority = number
146+
rewrite_rule_set_key = optional(string)
146147
rule_type = string
147148
}))
148149
```
@@ -199,6 +200,36 @@ Type: `number`
199200

200201
Default: `null`
201202

203+
### <a name="input_rewrite_rule_set"></a> [rewrite\_rule\_set](#input\_rewrite\_rule\_set)
204+
205+
Description: A map of request rewrite rules for the Application Gateway. The key name will be used to retrieve the name from var.names.
206+
207+
Type:
208+
209+
```hcl
210+
map(object({
211+
rewrite_rule = optional(map(object({
212+
rule_sequence = number
213+
condition = optional(map(object({
214+
ignore_case = optional(bool)
215+
negate = optional(bool)
216+
pattern = string
217+
variable = string
218+
})))
219+
request_header_configuration = optional(map(string))
220+
response_header_configuration = optional(map(string))
221+
url = optional(object({
222+
components = optional(string)
223+
path = optional(string)
224+
query_string = optional(string)
225+
reroute = optional(bool)
226+
}))
227+
})))
228+
}))
229+
```
230+
231+
Default: `{}`
232+
202233
### <a name="input_ssl_policy_name"></a> [ssl\_policy\_name](#input\_ssl\_policy\_name)
203234

204235
Description: n/a

infrastructure/modules/postgresql-flexible/main.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ resource "azurerm_postgresql_flexible_server" "postgresql_flexible_server" {
1313
backup_retention_days = var.backup_retention_days
1414
geo_redundant_backup_enabled = var.geo_redundant_backup_enabled
1515

16+
dynamic "high_availability" {
17+
for_each = var.enable_high_availability ? [1] : []
18+
content {
19+
mode = "ZoneRedundant"
20+
}
21+
}
22+
1623
authentication {
1724
active_directory_auth_enabled = true
1825
password_auth_enabled = var.password_auth_enabled

infrastructure/modules/postgresql-flexible/tfdocs.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,14 @@ Type: `bool`
181181

182182
Default: `false`
183183

184+
### <a name="input_enable_high_availability"></a> [enable\_high\_availability](#input\_enable\_high\_availability)
185+
186+
Description: Whether to enable high availability for the PostgreSQL Flexible Server.
187+
188+
Type: `bool`
189+
190+
Default: `false`
191+
184192
### <a name="input_key_vault_admin_pwd_secret_name"></a> [key\_vault\_admin\_pwd\_secret\_name](#input\_key\_vault\_admin\_pwd\_secret\_name)
185193

186194
Description: Key Vault secret name in which to store the Admin password, if one is created.

infrastructure/modules/postgresql-flexible/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ variable "sku_name" {
8181
type = string
8282
}
8383

84+
variable "enable_high_availability" {
85+
description = "Whether to enable high availability for the PostgreSQL Flexible Server."
86+
type = bool
87+
default = false
88+
}
89+
8490
variable "storage_mb" {
8591
# See: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/postgresql_flexible_server#storage_mb-2
8692
description = "The storage size in MB for the PostgreSQL Flexible Server."

0 commit comments

Comments
 (0)