Azure Postgres flexible server not able to PointInTimeRestore

Hi,

I’m using Terraform as IaC for our Azure cloud, and working on DR scripts for Terraform. As one of the steps, we want to restore postgres flexible server instances in another region. I’m trying to use PointInTimeRestore creat_mode in the module azurerm_postgresql_flexible_server but it fails with 404 error, can’t find the source server.

Terraform version: 1.6.3
Azurerm: 3.77.0

My terraform code:

resource "azurerm_postgresql_flexible_server" "psql" {
  name                         = var.psql_name
  resource_group_name          = azurerm_resource_group.rg.name
  location                     = azurerm_resource_group.rg.location
  version                      = var.psql_version
  create_mode                  = "PointInTimeRestore"
  source_server_id             = "/subscriptions/my-sub-id/resourceGroups/main-db-rg/providers/Microsoft.DBforPostgreSQL/flexibleServers/psql-main-db"
  point_in_time_restore_time_in_utc = "2023-10-19T10:59:50.154333Z"
  backup_retention_days        = var.psql_backup_retention_days
  sku_name                     = var.psql_sku
  storage_mb                   = var.psql_storage
  delegated_subnet_id          = data.azurerm_subnet.postgres_sn.id
  private_dns_zone_id          = data.azurerm_private_dns_zone.postgres_priv_dns.id
  tags                         = var.tags
}

When I run the terraform I get:

 Error: creating Flexible Server (Subscription: "my-sub-id"
 Resource Group Name: "rg-myrg-01"
 Flexible Server Name: "psql-restore-main-db"): performing Create: unexpected status 404 with error: ResourceNotFound: The requested resource of type 'Microsoft.DBforPostgreSQL/flexibleServers' with name 'psql-main-db' was not found.

with azurerm_postgresql_flexible_server.activity_psql,
on postgres.tf line 1, in resource "azurerm_postgresql_flexible_server" "psql":
 1: resource "azurerm_postgresql_flexible_server" "psql" {

I can create a replica just fine by replacing PointInTimeRestore with Replica and removing point_in_time_restore_time_in_utc.

Is anyone facing this problem as well?