Azure / Azure/azure-rest-api-specs
[BUG] [Postgresql Flexible Server] There is the inconsistency between the azureAsyncOperation and the GET API results
- Dominant language
- TypeSpec
- Stars
- 3.1k
- Forks
- 5.9k
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 444
Description
### API Spec link
https://github.com/Azure/azure-rest-api-specs/blob/e05316922122e792161f4e8c70f66ff8e791419c/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-06-01-preview/FlexibleServers.json#L212
### API Spec version
2023-06-01-preview
### Describe the bug
Users keep failing to recreate Postgresql FS with same name. After I investigated, I found that Terraform first calls the DELETE API to submit a deletion request, and then during the long-running operation (LRO) phase, it checks whether the resource exists by calling the GET API. If the resource exists, it retries the LRO; if it does not exist, it exits the operation.
Coming back to users' case, I found that after Terraform submitted the delete request, it called the GET API and found the resource as "NOTFOUND," so it exited normally. However, the delete operation was not actually finished, because when I called the azureAsyncOperation URL from the delete API response, it returned "status=InProgress", indicating that the delete operation was still ongoing.
The issue encountered by the user is caused by the inconsistency between the azureAsyncOperation and the GET API results. As I understand it, the GET API should return "NOTFOUND" only after the resource has been completely deleted. Service team confirmed that they are working on the fix.
### Expected behavior
GET API should return "NOTFOUND" only after the resource has been completely deleted.
### Actual behavior
GET API returns "NOTFOUND" but azureAsyncOperation is still ongoing.
### Reproduction Steps
1. Create resource group
2. Create Postgesql FS
3. Create replica Postgresql fs
4. Recreate replica Postgresql fs
### Environment
PROD
Contributor guide
Assessment
This issue has not been assessed yet.