From aebc32bddd498a7d6bf1379de6b811cb59e6a098 Mon Sep 17 00:00:00 2001 From: Balazs Nadasdi Date: Fri, 29 Sep 2023 13:48:48 +0200 Subject: [PATCH] docs: Document a fix to "terraform objects stuck on deletion" issue References: * https://github.com/weaveworks/weave-gitops-enterprise/issues/3152 Signed-off-by: Balazs Nadasdi --- docs/how_to/resource_deletion.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/how_to/resource_deletion.md b/docs/how_to/resource_deletion.md index 4222bef8..0e9db2fe 100644 --- a/docs/how_to/resource_deletion.md +++ b/docs/how_to/resource_deletion.md @@ -15,6 +15,25 @@ However, if the source object is unavailable or has been deleted, the re-plannin As a result, the Terraform Controller cannot locate the resource state, leading to an infinite deletion attempt cycle, commonly known as a looping process. +If the source object was deleted and the deletion of a Terraform resource is +stuck, clearing the `finalizers` let the system delete the resource skipping +the finalizer of the Terraform Controller. + +1. Suspend the `kustomization`: + ``` + flux suspend kustomization tf-stk + ``` +2. Patch the Terraform resource: + ``` + kubectl patch terraforms.infra.contrib.fluxcd.io \ + -n stk helloworld \ + -p '{"metadata":{"finalizers":null}}' \ + --type=merge + ``` + +As it skips the finalizer of the Terraform controller, any cleanup the +controller would do will be skipped too. + ## Role Bindings Role bindings assign permissions to Terraform runners, allowing them to execute operations within the Kubernetes cluster.