diff --git a/backports/OpenTofu/Base.gitlab-ci.yml b/backports/OpenTofu/Base.gitlab-ci.yml
index 1989cd9f6a55b0d7ca79af4bc66b5d10c8dc5569..fecf6ef80dfdfa4bf4ce12f0f4d86d332265020a 100644
--- a/backports/OpenTofu/Base.gitlab-ci.yml
+++ b/backports/OpenTofu/Base.gitlab-ci.yml
@@ -28,6 +28,10 @@ variables:
   image:
     name: '$GITLAB_OPENTOFU_IMAGE_REGISTRY_BASE/gitlab-opentofu:$GITLAB_OPENTOFU_VERSION-opentofu$OPENTOFU_VERSION'
 
+  variables:
+    TF_ROOT: $TF_ROOT
+    TF_STATE_NAME: $TF_STATE_NAME
+
   cache:
     key: "$TF_ROOT"
     paths:
diff --git a/templates/full-pipeline.yml b/templates/full-pipeline.yml
index 856f5546e42fecf807e7f35772804d4172e3ead9..8d616ad75c7347b375921c4585fb96a44a91cf1d 100644
--- a/templates/full-pipeline.yml
+++ b/templates/full-pipeline.yml
@@ -66,6 +66,10 @@ spec:
   image:
     name: '$[[ inputs._image_registry_base ]]/gitlab-opentofu:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]'
 
+  variables:
+    TF_ROOT: $[[ inputs.root_dir ]]
+    TF_STATE_NAME: $[[ inputs.state_name ]]
+
   cache:
     key: "$[[ inputs.root_dir ]]"
     paths: