> For the complete documentation index, see [llms.txt](https://docs.terrakube.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.terrakube.io/2.33.0/user-guide/vcs-providers/bitbucket.com.md).

# Bitbucket

Work in progress

For using repositories from Bitbucket.com with Terrakube workspaces and modules you will need to follow these steps:

{% hint style="info" %}
**Manage VCS Providers** permission is required to perform this action, please check [Team Management](/2.33.0/user-guide/organizations/team-management.md) for more info.
{% endhint %}

Navigate to the desired organization and click the **Settings** button, then on the left menu select **VCS Providers**

<figure><img src="https://3934308512-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCtajpHVKO4bym06TrmbV%2Fuploads%2Fgit-blob-014b437189fd580494cb401e7ebf8663972010c0%2Fimage%20(385).png?alt=media" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
If you prefer, you can add a new VCS Provider directly from the [Create workspace](/2.33.0/user-guide/workspaces/creating-workspaces.md) or Create Module screen.
{% endhint %}

Click the **Bitbucket** button and then click the **Bitbucket Cloud** option

<figure><img src="https://3934308512-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCtajpHVKO4bym06TrmbV%2Fuploads%2Fgit-blob-3d2e899287b9bc1f055112964ecc0c8c34c2282e%2Fimage%20(74).png?alt=media" alt=""><figcaption></figcaption></figure>

Open [Bitbucket Cloud](https://bitbucket.org) and log in as whichever account you want Terrakube to use and click the **settings** button in your workspace

<figure><img src="https://3934308512-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCtajpHVKO4bym06TrmbV%2Fuploads%2Fgit-blob-a6b56c6e7d353cd6bb040af85497f0be285ce97d%2Fimage%20(142).png?alt=media" alt=""><figcaption></figcaption></figure>

Click the **OAuth consumers** menu and then click the **Add consumer** button

<figure><img src="https://3934308512-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCtajpHVKO4bym06TrmbV%2Fuploads%2Fgit-blob-27ae09d7d117a0a5109bbcd6f1415e203b0ef484%2Fimage%20(146).png?alt=media" alt=""><figcaption></figcaption></figure>

Complete the required fields and click **Save** button

<table><thead><tr><th width="219">Field</th><th>Description</th></tr></thead><tbody><tr><td>Name</td><td>Your application name, for example you can use your organization name.</td></tr><tr><td>Description</td><td>Any description of your choice</td></tr><tr><td>Redirect URI</td><td>Copy the Redirect URI from the Terrakube UI</td></tr><tr><td>This is a private consumer (checkbox)</td><td>Checked</td></tr><tr><td>Permissions (checkboxes)</td><td><p>The following should be checked:</p><p><strong>Account</strong>: Write</p><p><strong>Repositories</strong>: Admin</p><p><strong>Pull requests</strong>: Write</p><p><strong>Webhooks</strong>: Read and write</p></td></tr></tbody></table>

{% hint style="info" %}
You can complete the fields using the information suggested by terrakube in the VCS provider screen
{% endhint %}

<figure><img src="https://3934308512-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCtajpHVKO4bym06TrmbV%2Fuploads%2Fgit-blob-db887ad9b966dd5ec5df00d08e6232f38f81c422%2Fimage%20(300).png?alt=media" alt=""><figcaption></figcaption></figure>

In the next screen, copy the **Key** and **Secret**

<figure><img src="https://3934308512-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCtajpHVKO4bym06TrmbV%2Fuploads%2Fgit-blob-b566bcf5aecfe86495c2781f68be650da7e11ecb%2Fimage%20(413).png?alt=media" alt=""><figcaption></figcaption></figure>

Go back to Terrakube to enter the information you copied from the previous step. Then, click the **Connect and Continue** button.

<figure><img src="https://3934308512-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCtajpHVKO4bym06TrmbV%2Fuploads%2Fgit-blob-1438c5d01a2e7785e9bad46beaa1f5a6624d31d8%2Fimage%20(324).png?alt=media" alt=""><figcaption></figcaption></figure>

You will see a Bitbucket window, click the **Grant Access** button to complete the connection

<figure><img src="https://3934308512-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCtajpHVKO4bym06TrmbV%2Fuploads%2Fgit-blob-50fdc9518942391fb6e5e7580172200b9bd284c7%2Fimage%20(400).png?alt=media" alt=""><figcaption></figcaption></figure>

Finally, if the connection was established successfully, you will be redirected to the VCS provider’s page in your organization. You should see the connection status with the date and the user that created the connection.

<figure><img src="https://3934308512-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCtajpHVKO4bym06TrmbV%2Fuploads%2Fgit-blob-0b262f568289316afe9883c8fc241b771e4dd018%2Fimage%20(158).png?alt=media" alt=""><figcaption></figcaption></figure>

And now, you will be able to use the connection in your workspaces and modules:

<figure><img src="https://3934308512-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCtajpHVKO4bym06TrmbV%2Fuploads%2Fgit-blob-b62f3d836f7e18404442a5c93a66c91dcf0e6e1f%2Fimage%20(411).png?alt=media" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.terrakube.io/2.33.0/user-guide/vcs-providers/bitbucket.com.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
