From 825d996225030b13cbd017340f64d08a728c391b Mon Sep 17 00:00:00 2001
From: Andrea Galbusera <gizero@gmail.com>
Date: Wed, 13 Jan 2021 10:33:41 +0100
Subject: [PATCH] CI: move variable evaluation to before_script

No shell "advanced" variable substitution is provided by the yaml 'variable:'
construct. This commit moves the evaluation of TF_COMMON_ARGS to the
before_script, where a shell provides the usual expansion mechanisms.
---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 907e070..828e378 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -7,7 +7,6 @@ variables:
   PLAN: plan.tfplan
   JSON_PLAN_FILE: plan.json
   GITLAB_TF_ADDRESS: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/terraform/state/${CI_PROJECT_NAME}"
-  TF_COMMON_ARGS: "-var hcloud_token=${HCLOUD_RW_TOKEN:=$HCLOUD_RO_TOKEN} -var theo_token=${THEO_TOKEN}"
 
 cache:
   key: "$CI_COMMIT_SHA"
@@ -32,6 +31,7 @@ before_script:
       -backend-config="lock_method=POST"
       -backend-config="unlock_method=DELETE"
       -backend-config="retry_wait_min=5"
+  - TF_COMMON_ARGS="-var hcloud_token=${HCLOUD_RW_TOKEN:=$HCLOUD_RO_TOKEN} -var theo_token=${THEO_TOKEN}"
 
 stages:
   - validate
-- 
GitLab