Skip to main content

How to Create Terraform Templates

This guide explains how to create a Terraform template in the GlobalAI platform, including how to define configuration details, provide Terraform code, and set deployment lifecycle rules.

Create a new Terraform Template

To start creating a new template, follow the steps below.

  1. In the left sidebar, expand the Infrastructure dropdown menu and select Terraform Templates.
  2. Click + Create template in the top-right corner. This opens the template creation form.
Create Terraform template button
  1. Fill in the following fields:
  • Name: Enter a unique name for the template.
  • Owner: Specify the owner of the template.
  • Description: Provide a short explanation of what the template provisions.
  • Tags: Add relevant tags to help categorize the template (for example, aws, prod).
  1. Provide the Terraform code using any of the configuration methods available.
Terraform template creation form

Configuration methods

You can provide the Terraform configuration using one of the methods described below.

Option 1: Upload a configuration archive.

This is the recommended option for Terraform projects with multiple files.

  1. Locate the Configuration archive field.
  2. Click Click to upload.
  3. Select a .zip or .tar.gz file containing your Terraform configuration.

Ensure the archive includes only the required Terraform files and excludes state files or secrets.

Option 2: Edit configuration text.

For simple or single-file configurations, you can use the built-in editor.

  1. Locate the Configuration text field.
  2. Click Edit.
  3. Enter your Terraform configuration code.
  4. Click Save to close the editor.

Set the deployment lifecycle

The deployment lifecycle defines how long the infrastructure remains active and what happens when the time expires.

Configure the following settings:

  • Environment action: Select the action to take when the deployment time expires.
    • Manual: Infrastructure remains active until you manually delete it.
    • Terminate: Infrastructure is automatically destroyed after the specified time.

      Note that, unlike Kubernetes workloads, Terraform-managed infrastructure cannot be paused or stopped.

  • Default time: Set how long the deployment remains active (for example, 30 for minutes or P1D for one day).
  • Grace time: Set an additional buffer period before the action is executed (for example, 10 for minutes).

Configure input variables

You can define variables that users must provide or that are automatically generated when they deploy this template. This makes your template reusable and dynamic across environments.

  1. Scroll to the Input variables section.
  2. Click Add additional parameters and select the data type for your variable.
  • The platform supports various formats including String, Numeric, JSON, Code, List, and Boolean.
  • Your selected variable appears in a new row below.
Select Terraform input variables
  1. Enter the Key (the variable name used in your Terraform configuration).
  2. Enter a Value to define a default, or leave it empty to require input during deployment.
  3. Optionally, select from Available predefined variables to automatically insert system values.
Input values and predefined variables

When configuring input variables, you define the values passed into your Terraform configuration. These values can be entered manually or selected from the platform’s predefined variables.

Predefined variables provide platform-generated values that are resolved at runtime and can be used when setting input variable values.
For details on available predefined variable categories and how they work, see the Predefined Variables article.

Finish creation

Once all sections are configured:

  1. Review the template details.
  2. Click Create.

The template is added to the Terraform Templates list and is ready to be used for deployments.

Now that you know how to create a Terraform template, explore these related guides.