Failed to create HA postgresql flexible server

I am trying to deploy highly available postgresql flexible server, per Terraform Registry, using code below:

resource "azurerm_postgresql_flexible_server" "bmaas-db-server" {
  name                         = "${var.bmaas_name}-${var.frame_site_name}-${var.bmaas_region}-db-server"
  resource_group_name          = azurerm_resource_group.bmaas.name
  location                     = var.bmaas_region
  version                      = var.bmaas_db_server_version
  delegated_subnet_id          = azurerm_subnet.bmaas-postgresql-subnet.id
  private_dns_zone_id          = azurerm_private_dns_zone.bmaas.id
  administrator_login          = var.bmaas_db_server_user
  administrator_password       = var.bmaas_db_server_password
  backup_retention_days        = var.bmaas_db_server_backup_retention
  geo_redundant_backup_enabled = true
  high_availability = {
    mode = "ZoneRedundant"
  }
...

It’s failing with following message:

Error: Unsupported argument

  on ../../modules/bmaas/db.tf line 12, in resource "azurerm_postgresql_flexible_server" "bmaas-db-server":
  12:   high_availability = {

An argument named "high_availability" is not expected here. Did you mean to
define a block of type "high_availability"?

I am using

terraform: 0.14.11
provider_azurerm: 2.99.0

Seems like HA is not supported when I want to provision with terraform. Any idea why?

I made error in the code, so that is why it was failing … Correct code should be like:

resource "azurerm_postgresql_flexible_server" "bmaas-db-server" {
  name                         = "${var.bmaas_name}-${var.frame_site_name}-${var.bmaas_region}-db-server"
  resource_group_name          = azurerm_resource_group.bmaas.name
  location                     = var.bmaas_region
  version                      = var.bmaas_db_server_version
  delegated_subnet_id          = azurerm_subnet.bmaas-postgresql-subnet.id
  private_dns_zone_id          = azurerm_private_dns_zone.bmaas.id
  administrator_login          = var.bmaas_db_server_user
  administrator_password       = var.bmaas_db_server_password
  backup_retention_days        = var.bmaas_db_server_backup_retention
  geo_redundant_backup_enabled = true
  high_availability {
    mode = "ZoneRedundant"
  }
...