# ALM Template Language

ALM Template provides several built-in functions that help you manage your ALM Template. These functions are named **ATL**, short for **A**LM **T**emplate **L**anguage. Not to be confused with Microsoft's [ATL](https://msdn.microsoft.com/en-us/library/3ax346b7.aspx).

Use ATL functions in your templates to assign values to properties that are not available until runtime.

{% hint style="info" %}
For now, ATL is only supported in AWS. Support for other cloud vendors will be available soon.\
You can use ATL functions only in specific parts of a template. Please refer to each functions' document for detailed explanation.
{% endhint %}

## computed  <a href="#computed" id="computed"></a>

*Usage:*

`${computed}`

This function is used to calculate the valid value for supported declarative in your ALM Template.

Example:

```javascript
"instance_type": "${computed}"
```

## use  <a href="#use" id="use"></a>

*Usage:*

`${use( .. )}`

This function is used to reference the value that you defined in other declarative already.

*Example:*

```javascript
"availability_zones": "${use(Layer1.provision.availability_zone),use(Layer2.provision.availability_zone)}"
```

**Note:** This function can only be used if the origin value is type of *string*, it cannot be applied to any other type of values. For referencing values such as object or array, you use `${copy( .. )}`.

## copy  <a href="#copy" id="copy"></a>

*Usage:*

`${copy( .. )}`

This function is used to copy the whole value that you defined in other declarative already.

*Example:*

```javascript
"security_group": "${copy(Layer1.provision.security_group)}"
```

## ref  <a href="#ref" id="ref"></a>

*Usage:*

`#ref( .. )`

Currently, this function can be used only in:

1. load\_balancer : security\_groups

   ```javascript
   "load_balancer": {
     "security_groups": "#ref(Layer2.provision.security_group)",
   },
   ```

   *Use case explanation:*

   When the load balancer requires specified security groups, you can use this function to reference the security groups that are defined in `security_group` declarative.

## share  <a href="#share" id="share"></a>

Usage:

`#share( .. )`

Currently, this function can be used in two declarative:

1. load\_balancer : subnets

   ```javascript
   "load_balancer": {
     "subnets": "#share(Layer1.provision.subnet,Layer2.provision.subnet)",
   },
   ```

   *Use case explanation:*

   When you deploy an *application* or *networking* load balancer on AWS, by default each load balancer requires at least two subnets, so you use this function to define the target subnets which will be used by this load balancer.
2. auto\_scaling

   ```javascript
   {
     "auto_scaling": "#share(Layer1.provision.auto_scaling)"
   }
   ```

   *Use case explanation:*

   When you register multiple load balancers to the instances that are in the same auto scaling group, you use this function to define the target auto scaling group which will be shared with this load balancer.


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.alphaus.cloud/v3.0-english/alm-template/alm-template-language.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
