Description
Choose geo-redundant backups if you need to restore PostgreSQL Flexible Server in another region. Azure copies the backups to the paired region.
Potential impact
Backups kept only in the primary region may be unavailable during a regional outage.
Remediation
Choose a supported var.region and set geo_redundant_backup_enabled = true at creation. To change redundancy for an existing server, declare a separate Terraform resource with a different server name. Keep the original until you have migrated the data, tested application access and switched over.
Examples
Both examples retain backups for seven days. Test a restore in the paired region and check the recovered data and recovery time.
Before
hcl
resource "azurerm_postgresql_flexible_server" "example" {
name = "dbserver"
location = var.region
resource_group_name = azurerm_resource_group.example.name
backup_retention_days = 7
geo_redundant_backup_enabled = false
}
After
hcl
resource "azurerm_postgresql_flexible_server" "example" {
name = "dbserver"
location = var.region
resource_group_name = azurerm_resource_group.example.name
backup_retention_days = 7
geo_redundant_backup_enabled = true
}