# Globalvar

This endpoint is used to create, update, search or delete global variables information inside a Terrakube organizations, this variables will be injected inside the jobs, workspace variables have priority over global variables if the same name is used.

{% hint style="warning" %}
You need to be part of the administrator Active Directory Group to work with this endpoint
{% endhint %}

### Entity fields:

| Path                        | Type    | Description                                                    |
| --------------------------- | ------- | -------------------------------------------------------------- |
| data.type                   | string  | Should be "variable"                                           |
| data.attributes.key         | string  | Unique variable name                                           |
| data.attributes.value       | string  | Key value                                                      |
| data.attributes.sensitive   | boolean | To hide the value when the output is sensitive                 |
| data.attributes.hcl         | boolean | Terraform HCL variable type                                    |
| data.attributes.category    | string  | Variable type could be TERRAFORM or ENV (Environment Variable) |
| data.attributes.description | string  | Free text                                                      |

### Example:

```
{
  "data": {
    "type": "globalvar",
    "attributes": {
      "key": "tag_name",
      "value": "HolaMundo",
      "sensitive": false,
      "hcl": false,
      "category": "TERRAFORM",
      "description": "Azure RG Tag"
    }
  }
}
```

### Supported Operations

{% openapi src="<https://2194998553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR6VsmuTZWhfdwP7uD6e0%2Fuploads%2Fgit-blob-401ec125d9dcac5aad1c972efac0c16d713c6c76%2Fv2_4%20(2).json?alt=media>" path="/organization/{organizationId}/globalvar" method="get" %}
[v2\_4 (2).json](https://2194998553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR6VsmuTZWhfdwP7uD6e0%2Fuploads%2Fgit-blob-401ec125d9dcac5aad1c972efac0c16d713c6c76%2Fv2_4%20\(2\).json?alt=media)
{% endopenapi %}

{% openapi src="<https://2194998553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR6VsmuTZWhfdwP7uD6e0%2Fuploads%2Fgit-blob-3b8c8be8ff945bb7211bc38afbfeb08cea5b5ebd%2Fv2_4.yaml?alt=media>" path="/organization/{organizationId}/globalvar" method="post" %}
[v2\_4.yaml](https://2194998553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR6VsmuTZWhfdwP7uD6e0%2Fuploads%2Fgit-blob-3b8c8be8ff945bb7211bc38afbfeb08cea5b5ebd%2Fv2_4.yaml?alt=media)
{% endopenapi %}

{% openapi src="<https://2194998553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR6VsmuTZWhfdwP7uD6e0%2Fuploads%2Fgit-blob-3b8c8be8ff945bb7211bc38afbfeb08cea5b5ebd%2Fv2_4.yaml?alt=media>" path="/organization/{organizationId}/globalvar/{globalvarId}" method="delete" %}
[v2\_4.yaml](https://2194998553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR6VsmuTZWhfdwP7uD6e0%2Fuploads%2Fgit-blob-3b8c8be8ff945bb7211bc38afbfeb08cea5b5ebd%2Fv2_4.yaml?alt=media)
{% endopenapi %}

{% openapi src="<https://2194998553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR6VsmuTZWhfdwP7uD6e0%2Fuploads%2Fgit-blob-3b8c8be8ff945bb7211bc38afbfeb08cea5b5ebd%2Fv2_4.yaml?alt=media>" path="/organization/{organizationId}/globalvar/{globalvarId}" method="patch" %}
[v2\_4.yaml](https://2194998553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR6VsmuTZWhfdwP7uD6e0%2Fuploads%2Fgit-blob-3b8c8be8ff945bb7211bc38afbfeb08cea5b5ebd%2Fv2_4.yaml?alt=media)
{% endopenapi %}

{% hint style="info" %}
For a complete list of organization operation please visit the [OpenAPI specification](https://github.com/AzBuilder/terrakube-server/tree/main/openapi-spec)
{% endhint %}
