terraform-provider-azurerm icon indicating copy to clipboard operation
terraform-provider-azurerm copied to clipboard

Issues with azurerm_postgresql_flexible_server_configuration creating pg_cron.jobs , pg_cron installed as azure extensions

Open avyamsh opened this issue 1 year ago • 4 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Community Note

  • Please vote on this issue by adding a :thumbsup: reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment and review the contribution guide to help.

Terraform Version

1.5.7

AzureRM Provider Version

v3.113.0

Affected Resource(s)/Data Source(s)

azurerm_postgresql_flexible_server_configuration

Terraform Configuration Files

resource "azurerm_postgresql_flexible_server_configuration" "this" {
  for_each  = local.default_pg_parameters
  server_id = azurerm_postgresql_flexible_server.this.id
  name      = each.key
  value     = each.value
}

locals {
  default_pg_parameters = {
    "azure.extensions" = "pg_cron"
    "pg_cron.jobs"     = "SELECT cron.schedule_in_database(job_name:='xxx_yyy', schedule:='1 12 1,15 * *', command:=$$select public.xxx_yyy_zzz()$$, database:='xxxxdb');"
  }

Debug Output/Panic Output

Error: updating Configuration (Subscription: "321372a9-8716-46f9-a18a-d4928222041b"
Resource Group Name: "neur-fxi-nonprod-nonprod-dpt-rg"
Flexible Server Name: "neur-fxi-nonprod-test-dpt"
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: '1e05ef6d-bca3-4e2e-ba3f-de98721ed55b'"
Activity Id: ""

---

API Response:

----[start]----
{"name":"e398e4ea-7fec-40c7-9a15-5479850c345c","status":"Failed","startTime":"2024-07-31T11:41:49.42Z","error":{"code":"InternalServerError","message":"An unexpected error occured while processing the request. Tracking ID: '1e05ef6d-bca3-4e2e-ba3f-de98721ed55b'"}}
-----[end]-----


  with module.main.module.postgres_flexible_dbserver["1"].azurerm_postgresql_flexible_server_configuration.this["pg_cron.jobs"],
  on .terraform/modules/main.postgres_flexible_dbserver/pg-params.tf line 1, in resource "azurerm_postgresql_flexible_server_configuration" "this":
   1: resource "azurerm_postgresql_flexible_server_configuration" "this" {

Expected Behaviour

should have created the pg_cron job which was being passed as a pg parameters but fails to create one.

Actual Behaviour

It failed giving the error above which is not user friendly as shown above instead of creating the pg_cron.jobs

Steps to Reproduce

Presuming a Postgres flexi server exists before you create azurerm_postgresql_flexible_server_configuration run the following steps to reproduce -

terraform init terraform plan terraform apply

Important Factoids

No response

References

No response

avyamsh avatar Aug 01 '24 16:08 avyamsh