terraform-provider-azurerm: PostgreSQL Flexible Server error

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave “+1” or “me too” comments, 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

Terraform Version

1.1.9

AzureRM Provider Version

3.4.0

Affected Resource(s)/Data Source(s)

azurerm_postgresql_flexible_server

Terraform Configuration Files

provider "azurerm" {
  features {}
}

resource "azurerm_resource_group" "example" {
  name     = "example-resources"
  location = "West Europe"
}

resource "azurerm_postgresql_flexible_server" "example" {
  name                   = "example-psqlflexibleserver"
  resource_group_name    = azurerm_resource_group.example.name
  location               = azurerm_resource_group.example.location
  version                = "12"
  administrator_login    = "psqladmin"
  administrator_password = "H@Sh1CoR3!"

  storage_mb = 32768

  sku_name = "GP_Standard_D4s_v3"
}

Debug Output/Panic Output

│ Error: waiting for creation of the Postgresql Flexible Server "example-psqlflexibleserver" (Resource Group "example-resources"): Code="ServerGroupDropping" Message="Operations on a server group in dropping state are not allowed."
│ 
│   with azurerm_postgresql_flexible_server.example,
│   on main.tf line 10, in resource "azurerm_postgresql_flexible_server" "example":
│   10: resource "azurerm_postgresql_flexible_server" "example" {

Expected Behaviour

No response

Actual Behaviour

No response

Steps to Reproduce

No response

Important Factoids

No response

References

https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/postgresql_flexible_server

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 32
  • Comments: 31 (2 by maintainers)

Commits related to this issue

Most upvoted comments

As @doug-fitzmaurice-rowden pointed it out rightly, it’s due to name not being available. Error message could have informed us the same. Throwing generic error message for such validation errors is so misleading and time wasting.

Aha scrap that - this is to do with the name of the server being in use or not:

resource "azurerm_postgresql_flexible_server" "example" {
  name                   = "example-psqlflexibleserver"
  ..
}
> Operations on a server group in dropping state are not allowed.
resource "azurerm_postgresql_flexible_server" "example" {
  name                   = "example-fgdkutitczvgvxr"
  ..
}
> azurerm_postgresql_flexible_server.example: Creation complete after 4m3s

The issue still exists on Azurerm 3.65.0; I have struggled for the past week with this issue. I would delete the flex server with Terraform by removing it from our script + Azure CLI after to make sure it was deleted, but I would still hit the above error when I tried to recreate the server again .

As I wrote before this problem occurs when I try to recreate server (same name) Finally I checked if I can deploy it manually in portal - same problem - Deploy Failed - “message”: “Operations on a server group in dropping state are not allowed.” Its Azure problem not Azurerm - probably Azure delays removing process. For end user server it looks like removed, but inside azure-cloud-machine still exist.

Same issue for me @green-munkey. Very frustrating. We spin up and tear down envs quite regularly, so this is a problem when the dB requires the same name every time.

Hitting this with 3.73 in westeurope.

This is happening even the resource is deleted. If I re-create from the portal it works but fails from terraform script.

Using Azurerm 3.72 and region: west US 2,Still randomly getting “message”:“Operations on a server group in dropping state are not allowed.” I resolved the issue by changing the location from west us2 to east us https://azure.microsoft.com/en-us/explore/global-infrastructure/geographies/#geographies

Thanks for raising this issue. After tested with latest azurerm provider and below tf config that is similar with yours, seems I cannot repro this issue. Could you try below tf config to see if the issue still exists?

tf config:

provider "azurerm" {
  features {}
}

resource "azurerm_resource_group" "example" {
  name     = "acctest-postgreslqfs-test01"
  location = "West Europe"
}

resource "azurerm_postgresql_flexible_server" "example" {
  name                   = "acctest-psqlflexibleserver-test01"
  resource_group_name    = azurerm_resource_group.example.name
  location               = azurerm_resource_group.example.location
  version                = "12"
  administrator_login    = "psqladmin"
  administrator_password = "B@Dh1CgR3!"

  storage_mb = 32768

  sku_name = "GP_Standard_D4s_v3"
}