> For the complete documentation index, see [llms.txt](https://docs.terrakube.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.terrakube.io/2.22.0/user-guide/organizations/global-variables.md).

# Global Variables

Global Variables allow you to define and apply variables one time across all workspaces within an organization. For example, you could define a global variable of provider credentials and automatically apply it to all workspaces.

{% hint style="warning" %}
Workspace variables have priority over global variables if the same name is used.
{% endhint %}

### Creating a Global Variable

{% hint style="info" %}
Only users that belongs to Terrakube administrator group can create global variables. This group is defined in the terrakube settings during deployment, for more details see [Security](/2.22.0/getting-started/security.md#administrator-group)
{% endhint %}

Once you are in the desired organization, click the **Settings** button, then in the left menu select the **Global Variables** option and click the **Add global variable** button

<figure><img src="https://content.gitbook.com/content/kJIcmDU7SpMIrNiHYtLu/blobs/B27q2glD3l0XC6FjbzS8/image.png" alt=""><figcaption></figcaption></figure>

In the popup, provide the required values. Use the below table as reference:

| Field       | Description                                                                                                                               |
| ----------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| Key         | Unique variable name                                                                                                                      |
| Value       | Key value                                                                                                                                 |
| Category    | Category could be Terraform Variable or Environment Variable                                                                              |
| Description | Free text to document the reason for this global variable                                                                                 |
| HCL         | Parse this field as HashiCorp Configuration Language (HCL). This allows you to interpolate values at runtime.                             |
| Sensitive   | Sensitive variables are never shown in the UI or API. They may appear in Terraform logs if your configuration is designed to output them. |

Finally click the **Save global variable** button and the variable will be created

<figure><img src="https://content.gitbook.com/content/kJIcmDU7SpMIrNiHYtLu/blobs/tYqOWNTMVBSJg9ofQuQp/image.png" alt=""><figcaption></figcaption></figure>

You will see the new global variable in the list. And now the variable will be injected in all the workspaces within the organization

<figure><img src="https://content.gitbook.com/content/kJIcmDU7SpMIrNiHYtLu/blobs/nMy4IQFQVuVdv1DH62UR/image.png" alt=""><figcaption></figcaption></figure>

### Edit a Global Variable

Click the **Edit** button next to the global variable you want to edit.

<figure><img src="https://content.gitbook.com/content/kJIcmDU7SpMIrNiHYtLu/blobs/2pm90taWJdElNwH5e6Nq/image.png" alt=""><figcaption></figcaption></figure>

Change the fields you need and click the **Save global variable** button

{% hint style="warning" %}
For security, you can't change the **Sensitive** field. So if you want to change one global variable to sensitive you must delete the existing variable and create a new one
{% endhint %}

<figure><img src="https://content.gitbook.com/content/kJIcmDU7SpMIrNiHYtLu/blobs/iLvBHbeNVpz4GMnYbYEj/image.png" alt=""><figcaption></figcaption></figure>

### Delete a Global Variable

Click the **Delete** button next to the global variable you want to delete, and then click the Yes button to confirm the deletion. Please take in consideration the deletion is irreversible

<figure><img src="https://content.gitbook.com/content/kJIcmDU7SpMIrNiHYtLu/blobs/4RZbCx06OmGa6cPnKuBM/image.png" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.terrakube.io/2.22.0/user-guide/organizations/global-variables.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
