Open sushmitapandey opened 7 months ago
Hi @sushmitapandey thanks for opening this issue. However, I could not reproduce this issue with the following TF configuration and steps. Could you please provide the minimal reproducible TF config (containing dependent resources and variable values) of this issue so that we could reproduce /troubleshoot?
Step1: Create a APIM service with the following config.
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "3.90.0"
}
}
}
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "test" {
name = "acctestRG-0222"
location = "eastus"
}
resource "azurerm_api_management" "test" {
name = "acctestAM-0222"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
publisher_name = "pub1"
publisher_email = "pub1@email.com"
sku_name = "Consumption_0"
}
Step2: Add the following config to create azurerm_api_management_product
.
resource "azurerm_api_management_product" "test" {
product_id = "test-product"
api_management_name = azurerm_api_management.test.name
resource_group_name = azurerm_resource_group.test.name
display_name = "Test Product"
subscription_required = true
approval_required = true
published = true
subscriptions_limit = 2
description = "This is an example description"
terms = "These are some example terms and conditions"
}
Step3: Run Terraform destroy
to destroy resources.
This is an intermittent issue, it sometimes fails sometimes it runs fine. So wanted to check wat dependencies should I put for the product?
Is there an existing issue for this?
Community Note
Terraform Version
1.5.0
AzureRM Provider Version
3.90.0
Affected Resource(s)/Data Source(s)
azure apim product
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
It should destroy the apim and it's dependent resources
Actual Behaviour
Error: deleting Product (Subscription: "12345678-1234-wygu-dshe-cc12738348273" 1452│ Resource Group Name: "demo-rg" 1453│ Service Name: "demo-apim-02" 1454│ Product: "product-api"): unexpected status 412 with error: PreconditionFailed: Exception of type 'Microsoft.WindowsAzure.ApiManagement
After re-running the detroy job it didn't throw any error
Steps to Reproduce
create APIM module create apim product terraform apply terraform destroy will throw the exception re-run terraform destroy - job will get succeeded
Important Factoids
No response
References
No response