Variables

This endpoint is used to create, update, search or delete variables information inside a Terrakube workspace.

To use this endpoint you should have "manageWorkspace" access at team level and a Terrakube workspace

Entity fields:

PathTypeDescription

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": "variable",
    "attributes": {
      "key": "tag_name",
      "value": "HolaMundo",
      "sensitive": false,
      "hcl": false,
      "category": "TERRAFORM",
      "description": "Azure RG Tag"
    }
  }
}

Supported Operations

Returns an instance of type variable

GET/api/v1/workspace/{workspaceId}/variable/{variableId}
Path parameters
workspaceId*string

workspace Identifier

variableId*string

variable Identifier

Query parameters
Response

Successful response

Body
datavariable (object)
includedarray of object

Included resources

Request
const response = await fetch('/api/v1/workspace/{workspaceId}/variable/{variableId}', {
    method: 'GET',
    headers: {},
});
const data = await response.json();
Response
{
  "data": {
    "type": "text",
    "id": "text",
    "attributes": {
      "category": "TERRAFORM",
      "description": "text",
      "hcl": false,
      "key": "text",
      "sensitive": false,
      "value": "text"
    },
    "relationships": {
      "workspace": {
        "id": "text",
        "type": "workspace"
      }
    }
  },
  "included": [
    {
      "id": "text",
      "type": "text"
    }
  ]
}

Creates an item of type variable and adds it to variable

POST/api/v1/workspace/{workspaceId}/variable
Path parameters
workspaceId*string

workspace Identifier

Body
datavariable (object)
Response

Successful response

Body
datavariable (object)
Request
const response = await fetch('/api/v1/workspace/{workspaceId}/variable', {
    method: 'POST',
    headers: {
      "Content-Type": "application/vnd.api+json"
    },
    body: JSON.stringify({}),
});
const data = await response.json();
Response
{
  "data": {
    "type": "text",
    "id": "text",
    "attributes": {
      "category": "TERRAFORM",
      "description": "text",
      "hcl": false,
      "key": "text",
      "sensitive": false,
      "value": "text"
    },
    "relationships": {
      "workspace": {
        "id": "text",
        "type": "workspace"
      }
    }
  }
}

Deletes an instance of type vcs

DELETE/api/v1/workspace/{workspaceId}/vcs/{vcsId}
Path parameters
workspaceId*string

workspace Identifier

vcsId*string

vcs Identifier

Response

Successful response

Request
const response = await fetch('/api/v1/workspace/{workspaceId}/vcs/{vcsId}', {
    method: 'DELETE',
    headers: {},
});
const data = await response.json();

Modifies an instance of type vcs

PATCH/api/v1/workspace/{workspaceId}/vcs/{vcsId}
Path parameters
workspaceId*string

workspace Identifier

vcsId*string

vcs Identifier

Body
datavcs (object)
Response

Successful response

Request
const response = await fetch('/api/v1/workspace/{workspaceId}/vcs/{vcsId}', {
    method: 'PATCH',
    headers: {
      "Content-Type": "application/vnd.api+json"
    },
    body: JSON.stringify({}),
});
const data = await response.json();

For a complete list of organization operation please visit the OpenAPI specification