diff --git a/infra/modules/apim/main.tf b/infra/modules/apim/main.tf index 610267e..359a487 100644 --- a/infra/modules/apim/main.tf +++ b/infra/modules/apim/main.tf @@ -4,7 +4,7 @@ locals { } resource "azapi_resource" "apim" { - type = "Microsoft.ApiManagement/service@2023-05-01-preview" + type = "Microsoft.ApiManagement/service@2023-03-01-preview" name = var.apim_name parent_id = var.resource_group_id location = var.location @@ -168,6 +168,7 @@ resource "azurerm_api_management_api_policy" "policy" { XML + depends_on = [ azurerm_api_management_named_value.tenant_id ] } # https://github.com/aavetis/azure-openai-logger/blob/main/README.md diff --git a/infra/providers.tf b/infra/providers.tf index 7150716..fd6d59e 100644 --- a/infra/providers.tf +++ b/infra/providers.tf @@ -32,6 +32,12 @@ provider "azurerm" { api_management { purge_soft_delete_on_destroy = true } + resource_group { + # This flag is set to mitigate an open bug in Terraform. For instance, the Resource Group is not deleted when a `Failure Anomalies` resource is present. + # As soon as this is fixed, we should remove this. + # Reference: https://github.com/hashicorp/terraform-provider-azurerm/issues/18026 + prevent_deletion_if_contains_resources = false + } } }