hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.6k stars 4.64k forks source link

azurerm_security_center_assessment_policy destroy give 500 api error #23311

Open sufzoli opened 1 year ago

sufzoli commented 1 year ago

Is there an existing issue for this?

Community Note

Terraform Version

1.3.7

AzureRM Provider Version

3.73.0

Affected Resource(s)/Data Source(s)

azurerm_security_center_assessment_policy

Terraform Configuration Files

resource "azurerm_security_center_assessment_policy" "aksc_asc_policy" {
  display_name = local.name_aksc
  severity     = "Medium"
  description  = "AKS Policy"
}

resource "azurerm_security_center_assessment" "aksc_asc_assessment" {
  assessment_policy_id = azurerm_security_center_assessment_policy.aksc_asc_policy.id
  target_resource_id   = azurerm_kubernetes_cluster.aksc.id
  status {
    code = "Healthy"
  }
}

Debug Output/Panic Output

Error: deleting Provider Assessment Metadata (Subscription: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
Assessment Metadata Name: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"): assessmentsmetadata.AssessmentsMetadataClient#DeleteInSubscription: Failure responding to request: StatusCode=500 -- Original Error: autorest/azure: error response cannot be parsed: {"" '\x00' '\x00'} error: EOF

Expected Behaviour

Destroy flawlesly

Actual Behaviour

The destroy only works for 2nd try (actually on the second try the resource is not even there, already destroyed)

Steps to Reproduce

terraform destroy

Important Factoids

No response

References

No response

neil-yechenwei commented 1 year ago

Thanks for raising this issue. Seems service API failed to delete this resource. So filed an issue on https://github.com/Azure/azure-rest-api-specs/issues/25865 for tracking.