# Bitbucket

This example show how easy is to integrate Terrakube Jobs in Bitbucket pipelines.

### YAML Definition

Add the following snippet to the script section of your `bitbucket-pipelines.yml` file:

```
script:
  - pipe: azbuilder/terrakube-pipe:1.0.0
    variables:
      LOGIN_ENDPOINT: "<string>" #optional Default: https://login.microsoftonline.com
      TERRAKUBE_TENANT_ID: "<string>"
      TERRAKUBE_APPLICATION_ID: "<string>"
      TERRAKUBE_APPLICATION_SECRET: "<string>"
      TERRAKUBE_APPLICATION_SCOPE: "<string>" #optional Default: api://Terrakube/.default
      TERRAKUBE_ORGANIZATION: "<string>"
      TERRAKUBE_WORKSPACE: "<string>"
      TERRAKUBE_TEMPLATE: "<string>"
      TERRAKUBE_ENDPOINT: "<string>"
      DEBUG: "<boolean>" # Optional Default: false
```

### Variables

| Variable                            | Usage                                               |
| ----------------------------------- | --------------------------------------------------- |
| LOGIN\_ENDPOINT                     | Default values: <https://login.microsoftonline.com> |
| TERRAKUBE\_TENANT\_ID (\*)          | Azure AD Application tenant ID                      |
| TERRAKUBE\_APPLICATION\_ID (\*)     | Azure AD Application tenant ID                      |
| TERRAKUBE\_APPLICATION\_SECRET (\*) | Azure AD Application tenant ID                      |
| TERRAKUBE\_APPLICATION\_SCOPE       | Default value: api://Terrakube/.default             |
| TERRAKUBE\_ORGANIZATION (\*)        | Terrakube organization name                         |
| TERRAKUBE\_WORKSPACE (\*)           | Terrakube workspace name                            |
| TERRAKUBE\_TEMPLATE (\*)            | Terrakube template name                             |
| TERRAKUBE\_ENDPOINT (\*)            | Terrakbue api endpoint                              |

*(\*) = required variable.*

### Examples

Basic example:

```
script:
  - pipe: docker://azbuilder/terrakube-pipe:1.0.0
    variables:
      TERRAKUBE_TENANT_ID: "36857254-c824-409f-96f5-d3f2de37b016"
      TERRAKUBE_APPLICATION_ID: "36857254-c824-409f-96f5-d3f2de37b016"
      TERRAKUBE_APPLICATION_SECRET: "SuperSecret"
      TERRAKUBE_ORGANIZATION: "terrakube"
      TERRAKUBE_WORKSPACE: "bitbucket"
      TERRAKUBE_TEMPLATE: "vulnerability-snyk"
      TERRAKUBE_ENDPOINT: "https://terrakube.interal/service"
```

Advanced example:

```
script:
  - pipe: docker://azbuilder/terrakube-pipe:1.0.0
    variables:
      LOGIN_ENDPOINT: "https://login.microsoftonline.com"
      TERRAKUBE_TENANT_ID: "36857254-c824-409f-96f5-d3f2de37b016"
      TERRAKUBE_APPLICATION_ID: "36857254-c824-409f-96f5-d3f2de37b016"
      TERRAKUBE_APPLICATION_SECRET: "SuperSecret"
      TERRAKUBE_APPLICATION_SCOPE: "api://TerrakubeApp/.default"
      TERRAKUBE_ORGANIZATION: "terrakube"
      TERRAKUBE_WORKSPACE: "bitbucket"
      TERRAKUBE_TEMPLATE: "vulnerability-snyk"
      TERRAKUBE_ENDPOINT: "https://terrakube.interal/service"
      DEBUG: "true"
```

For more information about this pipe please refer to the following [repository](https://github.com/AzBuilder/terrakube-pipe-bitbucket).


---

# Agent Instructions: 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:

```
GET https://docs.terrakube.io/2.19.0/user-guide/ci-cd-integration/bitbucket.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
