> ## Documentation Index
> Fetch the complete documentation index at: https://docs.amnify.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Using Templates

The template library is your starting point for any new deployment. This guide explains how to navigate the library, understand what a template does before using it, and how to add new templates or modify existing ones in your GitHub repository.

***

## Browsing the Template Library

1. Navigate to **Deploy** → **Templates** in the Amnify sidebar
2. The library shows all available templates synced from your GitHub repository
3. Templates are organized by category:
   * **Infrastructure** — networks, compute, clusters, storage
   * **Application** — web services, container deployments, serverless
   * **Database** — managed database services
   * **Combinations** — multi-component stacks

Use the **search bar** to find templates by name or description. Use the **category filter** to narrow results.

***

## Understanding a Template Before Using It

Before selecting a template for a new deployment, review its detail:

* **Description** — what the template provisions and what it is designed for
* **Variables** — what inputs you will need to provide: which are required vs optional, which are sensitive (e.g., passwords — you will not be able to see them after submission), and whether any variables have predefined options or link to existing cloud resources

Having this information upfront helps you prepare the values you need before starting the Deployment Creation wizard.

***

## Selecting a Template for a New Deployment

When creating a new Deployment:

1. In the Deployment Creation wizard, choose **Template** as the source type
2. Click **Browse Templates**
3. Select the template you want to use
4. The wizard advances to the variable configuration step

See [Creating Deployments](/cspm-deploy/guides/creating-deployments) for the full walkthrough.

***

## Your Template Repository

Templates live in a **GitHub repository owned by your organization**. Amnify Deploy syncs from this repository; it does not host or lock your templates internally. Your team has full control: add new templates by adding files to the repository, modify existing templates by editing files in GitHub, and version everything using standard Git workflows (branches, pull requests, tags).

***

## Repository Directory Structure

Your GitHub repository must follow this directory structure for Amnify to discover and sync templates:

```
your-repo/
└── templates/
    ├── azure/
    │   └── my-template/
    │       ├── template.json      ← manifest (required)
    │       └── main.tf            ← Terraform files
    ├── aws/
    │   └── ec2-instance/
    │       ├── template.json
    │       ├── main.tf
    │       └── outputs.tf
    └── gcp/
        └── compute-instance/
            ├── template.json
            └── main.tf
```

### Rules

* The top-level directory must be named **`templates/`**
* Provider subdirectories must be one of: **`azure`**, **`aws`**, **`gcp`**
* Each template is a subdirectory containing a **`template.json`** manifest and one or more **`.tf`** files
* All `.tf` files in the template directory are downloaded during deployment

### The `template.json` Manifest

Every template directory must contain a `template.json` file with this structure:

```json theme={null}
{
  "id": "azure-resource-group-v1",
  "name": "Azure Resource Group",
  "description": "Creates a new Azure Resource Group",
  "category": "infrastructure",
  "cloud_provider": "azure",
  "iac_type": "terraform",
  "icon": "cloud",
  "variables": [
    {
      "name": "resource_group_name",
      "type": "string",
      "description": "Name of the resource group",
      "required": true,
      "sensitive": false
    },
    {
      "name": "location",
      "type": "string",
      "description": "Azure region",
      "default": "West Europe",
      "required": false,
      "sensitive": false,
      "options": ["West Europe", "North Europe", "East US"]
    }
  ]
}
```

| Field            | Required | Description                                                  |
| ---------------- | -------- | ------------------------------------------------------------ |
| `id`             | Yes      | Unique identifier for the template                           |
| `name`           | Yes      | Display name shown in the UI                                 |
| `description`    | Yes      | Brief description of what the template provisions            |
| `category`       | Yes      | One of: `infrastructure`, `application`, `database`, `combo` |
| `cloud_provider` | Yes      | Must match the parent directory: `azure`, `aws`, or `gcp`    |
| `iac_type`       | Yes      | Currently only `terraform` is supported                      |
| `icon`           | No       | Lucide icon name for the UI                                  |
| `variables`      | Yes      | Array of variable definitions (see below)                    |

### Variable Properties

| Property        | Required | Description                                                                                        |
| --------------- | -------- | -------------------------------------------------------------------------------------------------- |
| `name`          | Yes      | Variable name — must match a `variable` block in your `.tf` files                                  |
| `type`          | Yes      | `string`, `number`, `bool`, `object`, or `list(object)`                                            |
| `description`   | No       | Help text shown in the UI                                                                          |
| `required`      | Yes      | Whether the variable must be filled in before deploying                                            |
| `sensitive`     | Yes      | If `true`, the value is masked in the UI and stored encrypted                                      |
| `default`       | No       | Default value pre-filled in the form                                                               |
| `options`       | No       | Array of allowed values — renders as a dropdown in the UI                                          |
| `resource_type` | No       | Terraform resource type (e.g., `azurerm_resource_group`) — enables the cloud resource picker       |
| `condition`     | No       | `{ "field": "other_var", "equals": "value" }` — shows this variable only when the condition is met |

***

## Adding a New Template

To make a new template available in Amnify Deploy:

1. **Author the template** in your GitHub repository following the directory structure above
2. **Commit and push** the new template to your repository's main branch (or the branch configured as the sync source)
3. **Trigger a Sync** in Amnify Deploy (see [Syncing Templates](#syncing-templates) below)
4. The new template appears in the library immediately after the sync completes

***

## Modifying an Existing Template

To update an existing template:

1. **Edit the template file** in your GitHub repository
   * You can change the infrastructure definition, update variable labels, add new variables, or change default values
2. **Commit and push** the changes
3. **Trigger a Sync** in Amnify Deploy

After syncing, the updated template is immediately available. Existing Deployments created from the old version of the template are not automatically affected — they will use the updated template the next time you re-execute them.

<Info>
  Changing a template's variables (adding required variables or removing existing ones) will affect Deployments that use it. If you add a new required variable, existing Deployments will need to be edited to provide a value for it before they can be executed again.
</Info>

***

## Syncing Templates

Amnify Deploy does not automatically pull changes from GitHub. To update the template library after changes in your repository:

1. Navigate to **Deploy** → **Templates**
2. Click **Sync Templates**
3. Amnify fetches the latest templates from your configured GitHub repository
4. New and updated templates appear in the library immediately

The sync is fast — it typically completes in a few seconds.

***

## Next Steps

* [Creating Deployments](/cspm-deploy/guides/creating-deployments) — turn a template into a running deployment
* [Templates concept page](/cspm-deploy/concepts/templates) — deeper conceptual overview of how templates work
