azurerm Terraform provider issue when creating a pg_cron.jobs after installing pg_cron as Azure extensions.
locals {
default_pg_parameters = {
"azure.extensions" = "pg_cron"
"pg_cron.jobs" = "SELECT cron.schedule_in_database(job_name:='xxx_yy_test', schedule:='1 12 1,15 * *', command:=$$select * from all$$, database:='postgres');"
}
}
resource "azurerm_postgresql_flexible_server_configuration" "cron_job" {
for_each = local.default_pg_parameters
name = each.key
server_id = azurerm_postgresql_flexible_server.example.id
value = each.value
depends_on = [azurerm_postgresql_flexible_server.example]
}
and seeing the error below which isn’t user friendly –
Error: updating Configuration (Subscription: “xxxx-cccc-sasdf-asdfsd-asdfasd-12132”
Resource Group Name: “xzxcv-rg”
Flexible Server Name: “example-postgres-flexi”
Configuration Name: “pg_cron.jobs”): polling after Update: polling failed: the Azure API returned the following error:
Status: "InternalServerError"
Code: ""
Message: "An unexpected error occured while processing the request. Tracking ID: '9131c5b9-e371-425b-834e-ac2027cce3a6'"
Activity Id: ""
---
API Response:
----[start]----
{"name":"3777d618-8e1e-47e7-956a-4f7b0a04c49e","status":"Failed","startTime":"2024-07-31T10:28:28.507Z","error":{"code":"InternalServerError","message":"An unexpected error occured while processing the request. Tracking ID: '9131c5b9-e371-425b-834e-ac2027cce3a6'"}}
-----[end]-----
with main.postgres_flexible_dbserver["1"].azurerm_postgresql_flexible_server_configuration.this["pg_cron.jobs"],