From 8e2694417da0c30881f8a4a0a5759cb56f5c664c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Heleno?= Date: Wed, 19 Jul 2023 10:19:51 +0200 Subject: [PATCH] fix: readd support to deactivate auto-sync which was broken by #6 --- main.tf | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/main.tf b/main.tf index 59dfad7..7ce4dce 100644 --- a/main.tf +++ b/main.tf @@ -66,10 +66,13 @@ resource "argocd_application" "this" { } sync_policy { - automated { - prune = var.app_autosync.prune - self_heal = var.app_autosync.self_heal - allow_empty = var.app_autosync.allow_empty + dynamic "automated" { + for_each = toset(var.app_autosync == { "allow_empty" = tobool(null), "prune" = tobool(null), "self_heal" = tobool(null) } ? [] : [var.app_autosync]) + content { + prune = automated.value.prune + self_heal = automated.value.self_heal + allow_empty = automated.value.allow_empty + } } retry {