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

# Standard Gitlab Integration

> Connect GitLab repositories to env zero using centralized VCS connections for template creation and deployments

<Warning>
  To integrate with GitLab, you need a GitLab user with Maintainer/Owner permissions on the necessary GitLab Project. We recommend using a designated shared bot user, as env zero performs actions as this user on the project/repository.

  If you do not have those permissions, ask an admin or a different user with those permissions to create the template.
</Warning>

## Prerequisites

Before creating a GitLab template, you need a GitLab VCS connection configured in your organization. To set one up, go to **Organization Settings > VCS** and create a new GitLab connection.

Learn more: [Managing VCS Connections](/guides/admin-guide/manage-vcs#centralized-management)

## New Template

If you would like to create the first GitLab Integrated Template in this env zero organization, please see **[Create Your First Template](/guides/getting-started/create-your-first-template)** instead.

<Steps>
  <Step title="Create Template">
    Click **ADD A NEW TEMPLATE** on the top right in the *Templates* screen. Pick your template type, enter a name for the template, and then click **NEXT**.
  </Step>

  <Step title="Select GitLab">
    Click on the **GitLab.com** button.
  </Step>

  <Step title="Select VCS Connection">
    Select a pre-configured GitLab VCS connection from the dropdown. If no connection exists, click **Add VCS Connection** to create one.
  </Step>

  <Step title="Select Repository">
    Pick the repository containing your IaC configuration from the list of accessible GitLab projects.
  </Step>

  <Step title="Configure Source">
    If you would like to pull the code from a specific revision or branch, enter that in the `Revision` field. Leaving this field empty will use your default branch, which is usually "master"/"main".

    Enter the folder your Terraform files are located in under `Terraform Folder`. If your Terraform files are in the root of the repository, leave this empty.
  </Step>

  <Step title="Configure Variables">
    Click **NEXT** to proceed to the variables section. Add environment and Terraform variables that you'd like to be used during deployment, and then click **NEXT** to go to the final "Projects" section.
  </Step>

  <Step title="Assign Projects">
    Pick the projects that you'd like to have access to deploy this template, and then click **DONE** to create the template.
  </Step>
</Steps>

<Warning>
  Troubleshoot

  * Can't find your repository? Verify that the VCS connection has access to the necessary GitLab project. You can check the available repositories in **Organization Settings > VCS** by selecting the relevant connection.
</Warning>

## Existing Template

If you would like to integrate an existing template with GitLab:

1. Go to the **Templates** screen, and click on **Settings** for the template you would like to integrate with GitLab.
2. Click on the **VCS** step. From there you can click on the **GitLab.com** button, and integrate with GitLab as you would for a new template.

<Info>
  Additional Content

  * [Managing Terraform variable hierarchy](https://www.env0.com/blog/managing-terraform-variable-hierarchy)
  * [Why env zero is a Terraform Cloud alternative?](https://www.env0.com/alternatives/terraform-cloud-alternative)
</Info>

## Next steps

* [Gitlab Enterprise Integration](/guides/admin-guide/templates/gitlab-enterprise-integration) - Connect a self-hosted GitLab instance.
* [Managing VCS](/guides/admin-guide/manage-vcs) - Manage all VCS provider connections in one place.
* [Standard GitHub Integration](/guides/admin-guide/templates/github-templates) - Connect GitHub as an alternative VCS provider.
* [Template Overview](/guides/admin-guide/templates) - Learn how templates are structured and configured.
