<p>The GitLab file variable name isn't the path to the file. <strong>It's the name of an environmental variable that stores the path to the file</strong>. Either way you'll have to move the key to where you want the file stored.</p>
<p>Let's say you set this in the GitLab UI,</p>
<pre><code>MYGITLAB_FILE_VARIABLE=contents
</code></pre>
<p>When that gets run <code>MYGITLAB_FILE_VARIABLE</code> will be some long and random path name on the runner. You'll have to run this in a CI job to get that file where you want.</p>
<pre><code>mv $MYGITLAB_FILE_VARIABLE /my/desired/path
</code></pre>

CC BY-SA 4.0
2023-04-11T16:10:57.177Z
2023-04-11T16:10:57.177Z
Evan Carroll
<p>I used double __ and renamed them to dots during the pipeline process.
Its not ideal but works</p>
<p><code>env |sed 's/__/./g' &gt; application.properties</code></p>

CC BY-SA 4.0
2023-09-21T06:54:59.477Z
2023-09-21T06:54:59.477Z
Malan
<p>I have a file called <code>.auto.tfvars</code> that I want to use to set some Terraform variables in an CI run, however when I try to add it, I get a popup called,</p>
<blockquote>
<p>Variables key can contain only letters, digits and '_'.</p>
</blockquote>
<p>Looking at the documentation for <a href="https://docs.gitlab.com/ee/ci/variables/#use-file-type-cicd-variables" rel="nofollow noreferrer">GitLab CI/CD variables</a>, I don't see this restriction mentioned nor a workaround.</p>

<gitlab>
GitLab file variable with a dot or period `.` in its name?
Evan Carroll
# GitLab file variable with a dot or period `.` in its name?

(Asked by: username_0 on 2023-04-10)

I have a file called `.auto.tfvars` that I want to use to set some Terraform variables in an CI run, however when I try to add it, I get a popup called,

> Variables key can contain only letters, digits and '\_'.

Looking at the documentation for [GitLab CI/CD variables](https://docs.gitlab.com/ee/ci/variables/#use-file-type-cicd-variables), I don't see this restriction mentioned nor a workaround.

**Tags:** gitlab


---

## 2 answers

### Answer by username_0 on 2023-04-11. Score: 0 | Accepted answer

The GitLab file variable name isn't the path to the file. It's the name of an environmental variable that stores the path to the file. Either way you'll have to move the key to where you want the file stored.
Let's say you set this in the GitLab UI,
MYGITLAB_FILE_VARIABLE=contents

When that gets run MYGITLAB_FILE_VARIABLE will be some long and random path name on the runner. You'll have to run this in a CI job to get that file where you want.
mv $MYGITLAB_FILE_VARIABLE /my/desired/path


---

### Answer by username_1 on 2023-09-21. Score: 0

I used double \_\_ and renamed them to dots during the pipeline process.
Its not ideal but works

`env |sed 's/__/./g' > application.properties`


---

