From 6c920824355a4e84372e64c5d9b3f3a0cfc8274f Mon Sep 17 00:00:00 2001
From: Timo Furrer <tfurrer@gitlab.com>
Date: Thu, 18 Jan 2024 17:10:14 +0100
Subject: [PATCH] Fix apply rule

---
 backports/OpenTofu/Base.gitlab-ci.yml | 4 ++--
 templates/full-pipeline.yml           | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/backports/OpenTofu/Base.gitlab-ci.yml b/backports/OpenTofu/Base.gitlab-ci.yml
index d13cec1..beb26ab 100644
--- a/backports/OpenTofu/Base.gitlab-ci.yml
+++ b/backports/OpenTofu/Base.gitlab-ci.yml
@@ -95,7 +95,7 @@ variables:
     action: start
   resource_group: $TF_STATE_NAME
   rules:
-    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $TF_AUTO_APPLY == "true"
+    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && "$TF_AUTO_APPLY" == "true"'
     - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
       when: manual
 
@@ -109,7 +109,7 @@ variables:
     action: stop
   resource_group: $TF_STATE_NAME
   rules:
-    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $TF_AUTO_DESTROY == "true"
+    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && "$TF_AUTO_DESTROY" == "true"'
     - when: manual
 
 .opentofu:delete-state:
diff --git a/templates/full-pipeline.yml b/templates/full-pipeline.yml
index fc77131..cb5b834 100644
--- a/templates/full-pipeline.yml
+++ b/templates/full-pipeline.yml
@@ -123,7 +123,7 @@ apply:
     action: start
   resource_group: $[[ inputs.state_name ]]
   rules:
-    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $[[ inputs.auto_apply ]] == "true"
+    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && "$[[ inputs.auto_apply ]]" == "true"'
     - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
       when: manual
 
@@ -137,7 +137,7 @@ destroy:
     action: stop
   resource_group: $[[ inputs.state_name ]]
   rules:
-    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $[[ inputs.auto_destroy ]] == "true"
+    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && "$[[ inputs.auto_destroy ]]" == "true"'
     - when: manual
 
 delete-state:
-- 
GitLab