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
Description
When deploying a subscription with resources for testing purposes and trying to cancel said subscription after deleting all resources, from time to time Azure seems to still find some resources (that aren't there anymore).
In the Azure Portal exists a 'force'/'Ignore resource' option which will cancel the subscription immediately.
Right now the cancellation times out after 30 minutes if those 'ghost' resources are still found.
A couple hours or sometimes even a day later the subscription can be cancelled.
New or Affected Resource(s)
azurerm_subscription
Potential Terraform Configuration
A new flag 'ignore_resource_check = true|false' would be introduced, propably defaulting to 'false'.
If the flag 'ignore_resource_check' is set to true the Api call would use the 'IgnoreResourceCheck', otherwise it would not.
data "azurerm_billing_enrollment_account_scope" "example" {
billing_account_name = "1234567890"
enrollment_account_name = "0123456"
}
resource "azurerm_subscription" "example" {
subscription_name = "My Example EA Subscription"
billing_scope_id = data.azurerm_billing_enrollment_account_scope.example.id
ignore_resource_check = true|false
}
The Azure Portal performs this exact call when cancelling a subscription with existing resources, except it uses the old '2019-03-01-preview" Api.
I tested the call with the current Api which works just fine:
https://management.azure.com/subscriptions//providers/Microsoft.Subscription/cancel?IgnoreResourceCheck=true&api-version=2020-09-01
chris@cktwo:~$ az rest --method POST --url "https://management.azure.com/subscriptions/<SUBSCRIPTION_ID>/providers/Microsoft.Subscription/cancel?IgnoreResourceCheck=true&api-version=2020-09-01"
{
"subscriptionId": "<SUBSCRIPTION_ID>"
}
Community Note
Description
When deploying a subscription with resources for testing purposes and trying to cancel said subscription after deleting all resources, from time to time Azure seems to still find some resources (that aren't there anymore). In the Azure Portal exists a 'force'/'Ignore resource' option which will cancel the subscription immediately.
Right now the cancellation times out after 30 minutes if those 'ghost' resources are still found. A couple hours or sometimes even a day later the subscription can be cancelled.
New or Affected Resource(s)
Potential Terraform Configuration
A new flag 'ignore_resource_check = true|false' would be introduced, propably defaulting to 'false'. If the flag 'ignore_resource_check' is set to true the Api call would use the 'IgnoreResourceCheck', otherwise it would not.
References
The flag is not documented but it exists: https://github.com/Azure/azure-rest-api-specs/issues/9042
The Azure Portal performs this exact call when cancelling a subscription with existing resources, except it uses the old '2019-03-01-preview" Api. I tested the call with the current Api which works just fine: https://management.azure.com/subscriptions//providers/Microsoft.Subscription/cancel?IgnoreResourceCheck=true&api-version=2020-09-01