# Available variables

You can use variables in stack and stack group configuration files and stack template files. Each of them has a different set of variables available.

## Stack group configuration files

Here are variables available in stack group configuration files:

| Key                             | Type      | Description                                                                     |
| ------------------------------- | --------- | ------------------------------------------------------------------------------- |
| env                             | object    | Environment variables.                                                          |
| context                         | object    | An object containing context variables.                                         |
| context.projectDir              | string    | Current project directory.                                                      |
| stackGroup                      | object    | An object representing the current stack group.                                 |
| stackGroup.name                 | string    | Name of the stack group.                                                        |
| stackGroup.path                 | string    | Path of the stack group.                                                        |
| stackGroup.pathSegments         | string\[] | Path of the stack group split into an array using **/** as a separator.         |
| parent                          | object    | An object representing the parent stack group where the stack group belongs to. |
| parent.accountIds               | string\[] | Account ids of the parent stack group.                                          |
| parent.capabilities             | string\[] | Capabilities of the parent stack group.                                         |
| parent.commandRole              | string    | Command role of the parent stack group.                                         |
| parent.data                     | object    | Data object of the parent stack group.                                          |
| parent.isRoot                   | boolean   | Is the parent stack group the root.                                             |
| parent.name                     | string    | Name of the parent stack group.                                                 |
| parent.path                     | string    | Path of the parent stack group.                                                 |
| parent.pathSegments             | string\[] | Path of the parent stack group split into an array using **/** as a separator.  |
| parent.project                  | string    | Project of the parent stack group.                                              |
| parent.regions                  | string    | Regions of the parent stack group.                                              |
| parent.tags                     | object\[] | Stack tags of the parent stack group.                                           |
| parent.tags\[].key              | string    | Tag key.                                                                        |
| parent.tags\[].value            | string    | Tag value.                                                                      |
| parent.templateBucket           | object    | Template bucket configuration of the parent stack group.                        |
| parent.templateBucket.name      | string    | Name of the template bucket.                                                    |
| parent.templateBucket.keyPrefix | string    | Key prefix of the template bucket.                                              |
| parent.timeout                  | object    | Timeout configuration of the parent stack group.                                |
| parent.timeout.create           | number    | Create timeout in seconds.                                                      |
| parent.timeout.update           | number    | Update timeout in seconds.                                                      |
| var                             | object    | Variables from the command line.                                                |

## Stack configuration files

Here are variables available in stack configuration files:

| Key                                 | Type      | Description                                                                                     |
| ----------------------------------- | --------- | ----------------------------------------------------------------------------------------------- |
| context                             | object    | An object containing context variables.                                                         |
| context.projectDir                  | string    | Current project directory.                                                                      |
| env                                 | object    | Environment variables.                                                                          |
| stackGroup                          | object    | An object representing the stack group where the stack belongs to.                              |
| stackGroup.accountIds               | string\[] | Account ids of the stack group.                                                                 |
| stackGroup.capabilities             | string\[] | Capabilities of the stack group.                                                                |
| stackGroup.commandRole              | string    | Command role of the stack group.                                                                |
| stackGroup.data                     | object    | Data object of the stack group.                                                                 |
| stackGroup.isRoot                   | boolean   | Is the stack group the root.                                                                    |
| stackGroup.name                     | string    | Name of the stack group.                                                                        |
| stackGroup.path                     | string    | Path of the stack group.                                                                        |
| stackGroup.pathSegments             | string\[] | Path of the stack group split into an array using **/** as a separator.                         |
| stackGroup.project                  | string    | Project of the stack group.                                                                     |
| stackGroup.regions                  | string    | Regions of the stack group.                                                                     |
| stackGroup.tags                     | object\[] | Stack tags of the stack group.                                                                  |
| stackGroup.tags\[].key              | string    | Tag key.                                                                                        |
| stackGroup.tags\[].value            | string    | Tag value.                                                                                      |
| stackGroup.templateBucket           | object    | Template bucket configuration of the stack group.                                               |
| stackGroup.templateBucket.name      | string    | Name of the template bucket.                                                                    |
| stackGroup.templateBucket.keyPrefix | string    | Key prefix of the template bucket.                                                              |
| stackGroup.timeout                  | object    | Timeout configuration of the stack group.                                                       |
| stackGroup.timeout.create           | number    | Create timeout in seconds.                                                                      |
| stackGroup.timeout.update           | number    | Update timeout in seconds.                                                                      |
| stack                               | object    | An object representing the stack.                                                               |
| stack.configFile                    | object    | An object representing configuration file of the stack.                                         |
| stack.configFile.basename           | string    | Name of the stack configuration file including the file extension                               |
| stack.configFile.dirPath            | string    | File path to the directory containing the stack configuration file relative to stack directory. |
| stack.configFile.filePath           | string    | File path of the stack configuration file relative to stack directory.                          |
| stack.configFile.name               | string    | Name of the stack configuration file without the file extension.                                |
| stack.path                          | string    | Path of the stack without the region specified.                                                 |
| stack.pathSegments                  | string\[] | Path of the stack without the region specified split into an array using **/** as a separator.  |
| var                                 | object    | Variables from the command line.                                                                |

## Stack template files

Here are variables available in stack template files:

| Key                            | Type      | Description                                                                                                     |
| ------------------------------ | --------- | --------------------------------------------------------------------------------------------------------------- |
| context                        | object    | An object containing context variables.                                                                         |
| context.projectDir             | string    | Current project directory.                                                                                      |
| env                            | object    | Environment variables.                                                                                          |
| hooks                          | object    | An object containing values returned by hooks                                                                   |
| stack                          | object    | An object representing the current stack                                                                        |
| stack.accountIds               | string\[] | Account ids of the stack.                                                                                       |
| stack.commandRole              | string    | Command role of the stack.                                                                                      |
| stack.configFile               | object    | An object representing configuration file of the stack.                                                         |
| stack.configFile.basename      | string    | Name of the stack configuration file including the file extension                                               |
| stack.configFile.dirPath       | string    | File path to the directory containing the stack configuration file relative to stack directory.                 |
| stack.configFile.filePath      | string    | File path of the stack configuration file relative to stack directory.                                          |
| stack.configFile.name          | string    | Name of the stack configuration file without the file extension.                                                |
| stack.data                     | object    | Data object of the stack.                                                                                       |
| stack.depends                  | string\[] | Dependencies of the stack.                                                                                      |
| stack.name                     | string    | Name of the stack.                                                                                              |
| stack.path                     | string    | Path of the stack.                                                                                              |
| stack.pathSegments             | string\[] | Path of the stack split into an array using **/** as a separator.                                               |
| stack.parameters               | object\[] | Parameters of the stack                                                                                         |
| stack.parameters\[].key        | string    | Parameters key                                                                                                  |
| stack.parameters\[].value      | string    | Parameters value                                                                                                |
| stack.parametersMap            | object    | Stack parameters in an object where each key is a parameter key and value is the corresponding parameter value. |
| stack.project                  | string    | Project of the stack.                                                                                           |
| stack.region                   | string    | Region of the stack.                                                                                            |
| stack.tags                     | object\[] | Stack tags of the stack.                                                                                        |
| stack.tags\[].key              | string    | Tag key.                                                                                                        |
| stack.tags\[].value            | string    | Tag value.                                                                                                      |
| stack.template                 | string    | Template of the stack.                                                                                          |
| stack.templateBucket           | object    | Template bucket configuration of the stack.                                                                     |
| stack.templateBucket.name      | string    | Name of the template bucket.                                                                                    |
| stack.templateBucket.keyPrefix | string    | Key prefix of the template bucket.                                                                              |
| stack.timeout                  | object    | Timeout configuration of the stack.                                                                             |
| stack.timeout.create           | number    | Create timeout in seconds.                                                                                      |
| stack.timeout.update           | number    | Update timeout in seconds.                                                                                      |
| var                            | object    | Variables from the command line.                                                                                |
