Azure / Azure/terraform-provider-azapi
Destroy Microsoft.Security/pricings results in 400: Bad Request
- Dominant language
- Go
- Stars
- 244
- Forks
- 97
- Avg merge
- 5d 9h
- Merged PRs (30d)
- 9
Description
If i try to 'destroy' Microsoft.Security/pricings I get the following error message:
```
azapi_resource.securityPricing: Destroying... [id=/subscriptions//providers/Microsoft.Security/pricings/VirtualMachines]
╷
│ Error: Failed to delete resource
│
│ deleting Resource: (ResourceId "/subscriptions//providers/Microsoft.Security/pricings/VirtualMachines" / Api Version "2024-01-01"): DELETE https://management.azure.com/subscriptions//providers/Microsoft.Security/pricings/VirtualMachines
│ --------------------------------------------------------------------------------
│ RESPONSE 400: 400 Bad Request
│ ERROR CODE: InvalidUrlConfiguration
│ --------------------------------------------------------------------------------
│ {
│ "error": {
│ "code": "InvalidUrlConfiguration",
│ "message": "Delete operation is supported only for single resources scope (not subscriptions). Use PUT to Enabled or Disable specific pricing bundles on a subscription."
│ }
│ }
│ --------------------------------------------------------------------------------
```
Is there a way to override this behavior since Pricing Plans can only be set to Free from Standard. Here is a small example code.
```
terraform {
required_providers {
azapi = {
source = "Azure/azapi"
version = "2.3.0"
}
}
}
provider "azapi" {}
data "azapi_client_config" "current" {}
resource "azapi_resource" "securityPricing" {
type = "Microsoft.Security/pricings@2024-01-01"
name = "VirtualMachines"
parent_id = data.azapi_client_config.current.subscription_resource_id
body = {
properties = {
pricingTier = "Standard"
subPlan = "P1"
}
}
}
```
Contributor guide
Research direction
Start by reproducing the azapi_resource configuration for Microsoft.Security/pricings@2024-01-01 and inspect the DELETE request shown in the issue. Compare the Azure API's supported PUT and DELETE operations for subscription pricing bundles. Done means the provider handles destruction consistently with the API limitation or clearly documents the supported behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, go, terraform
- Domain
- api, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100