# 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

## GET /organization/{organizationId}/globalvar

> Returns the relationship globalvar

```json
{"openapi":"3.0.1","info":{"title":"Elide Service","version":"0.0.1"},"tags":[{"name":"globalvar"}],"servers":[{"url":"/api/v1"}],"paths":{"/organization/{organizationId}/globalvar":{"get":{"tags":["globalvar"],"description":"Returns the relationship globalvar","parameters":[{"name":"sort","in":"query","description":"Sorts the collection on the selected attributes.  A prefix of '-' sorts descending","style":"form","explode":false,"schema":{"type":"array","items":{"type":"string","enum":["description","-description","hcl","-hcl","key","-key","sensitive","-sensitive","value","-value","id","-id"]}}},{"name":"fields[globalvar]","in":"query","description":"Selects the set of globalvar fields that should be returned in the result.","style":"form","explode":false,"schema":{"type":"array","items":{"type":"string","enum":["category","description","hcl","key","sensitive","value","organization"]}}},{"name":"include","in":"query","description":"Selects the set of relationships that should be expanded as a compound document in the result.","style":"form","explode":false,"schema":{"type":"array","items":{"type":"string","enum":["organization"]}}},{"name":"filter[globalvar]","in":"query","description":"Filters the collection of globalvar using a 'disjoint' RSQL expression","schema":{"type":"string"}},{"name":"page[number]","in":"query","description":"Number of pages to return.  Can be used with page[size]","schema":{"type":"integer","format":"int32"}},{"name":"page[size]","in":"query","description":"Number of elements per page.  Can be used with page[number]","schema":{"type":"integer","format":"int32"}},{"name":"page[offset]","in":"query","description":"Offset from 0 to start paginating.  Can be used with page[limit]","schema":{"type":"integer","format":"int32"}},{"name":"page[limit]","in":"query","description":"Maximum number of items to return.  Can be used with page[offset]","schema":{"type":"integer","format":"int32"}},{"name":"page[totals]","in":"query","description":"For requesting total pages/records be included in the response page meta data","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/vnd.api+json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/globalvar"}},"included":{"uniqueItems":true,"type":"array","description":"Included resources","items":{"type":"object","properties":{"type":{"type":"string"},"id":{"type":"string"},"attributes":{"type":"object"},"relationships":{"type":"object"}}}}}}}}}}}}},"components":{"schemas":{"globalvar":{"type":"object","properties":{"type":{"type":"string","description":"Create Permissions : (user is a superuser)\nDelete Permissions : (user is a superuser)"},"id":{"type":"string"},"attributes":{"type":"object","properties":{"category":{"type":"string","description":"Update Permissions : (user is a superuser)","readOnly":false,"writeOnly":false,"enum":["TERRAFORM","ENV"]},"description":{"type":"string","description":"Update Permissions : (user is a superuser)","readOnly":false,"writeOnly":false},"hcl":{"type":"boolean","description":"Update Permissions : (user is a superuser)","readOnly":false,"writeOnly":false},"key":{"type":"string","description":"Update Permissions : (user is a superuser)","readOnly":false,"writeOnly":false},"sensitive":{"type":"boolean","description":"Update Permissions : (admin update secret)","readOnly":false,"writeOnly":false},"value":{"type":"string","description":"Read Permissions : (admin read secret)\nUpdate Permissions : (user is a superuser)","readOnly":false,"writeOnly":false}}},"relationships":{"type":"object","properties":{"organization":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["organization"]},"id":{"type":"string"}},"description":"Update Permissions : (user is a superuser)","readOnly":false,"writeOnly":false}}}}}}}}}}}
```

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

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

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