> ## 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 Bitbucket Integration

> Connect Bitbucket Cloud repositories to env zero to create templates and manage deployments using the Bitbucket App for repository access.

<Warning>
  To integrate with Bitbucket, you need the necessary permissions on your Bitbucket workspace/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 Bitbucket template, you need a Bitbucket VCS connection configured in your organization. To set one up, go to **Organization Settings > VCS** and create a new Bitbucket connection.

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

## New Template

If you would like to create your first Bitbucket 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 Bitbucket">
    Click on the **Bitbucket.org** button.
  </Step>

  <Step title="Select VCS Connection">
    Select a pre-configured Bitbucket 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.
  </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 IaC files are located in under `Terraform Folder` or `Terragrunt Folder`. If your IaC 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 IaC 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>
  Troubleshooting

  * Can't find your repository? Verify that the VCS connection has access to the necessary Bitbucket workspace/repository. 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 Bitbucket:

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

## Next steps

* [Bitbucket Server Integration](/guides/admin-guide/templates/bitbucket-server-integration) - Connect a self-hosted Bitbucket Data Center 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.
