Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solved Issue 62: Unable to delete APIM when destroying infrastructure with Terraform. #63

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion infra/modules/apim/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -168,6 +168,7 @@ resource "azurerm_api_management_api_policy" "policy" {
</on-error>
</policies>
XML
depends_on = [ azurerm_api_management_named_value.tenant_id ]
}

# https://github.com/aavetis/azure-openai-logger/blob/main/README.md
Expand Down
6 changes: 6 additions & 0 deletions infra/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

Expand Down
Loading