From eea093279672fd4ba955e9c1bc866effd22475da Mon Sep 17 00:00:00 2001 From: Veronika Gnilitska Date: Thu, 19 Dec 2024 09:07:26 -0500 Subject: [PATCH] fix: check if file exists only if when it's expected --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 1a5c3a0..3426795 100644 --- a/main.tf +++ b/main.tf @@ -292,7 +292,7 @@ resource "spacelift_stack" "default" { lifecycle { # Expected `tfvars` file exists precondition { - condition = fileexists("${local.configs[each.key].project_root}/tfvars/${local.configs[each.key].tfvars_file_name}.tfvars") + condition = try(local.configs[each.key].tfvars.enabled, true) ? fileexists("${local.configs[each.key].project_root}/tfvars/${local.configs[each.key].tfvars_file_name}.tfvars") : true error_message = <<-EOT The required .tfvars file is missing for stack "${each.key}".