# dokploy_bitbucket_provider (Resource)

A Bitbucket connection (Git > Bitbucket). Applications and composes then use the `bitbucket` source block with this record's `id`. Two credential shapes exist: `username` with an app password, which Atlassian has deprecated, or `email` with an API token. Set exactly one shape.

~> **Dokploy stores and returns `app_password` and `api_token` in cleartext.** Both attributes are sensitive, so Terraform does not print them, but anyone with API access to the server can read them. The `_wo` companions keep them out of the Terraform state.

~> Dokploy does not test the credentials on create or update. A wrong token applies successfully and fails when Dokploy lists repositories.

## Example Usage

```terraform
# The API-token shape: an Atlassian account email with an API token.
resource "dokploy_bitbucket_provider" "main" {
  name           = "acme"
  email          = "deploy-bot@example.com"
  workspace_name = "acme"

  # Write-only: Terraform 1.11 or later. Change the version to rotate the token.
  api_token_wo         = var.bitbucket_api_token
  api_token_wo_version = 1
}

# The app-password shape, which Atlassian has deprecated. Keep it only for
# an existing setup.
resource "dokploy_bitbucket_provider" "legacy" {
  name         = "acme-legacy"
  username     = "deploy-bot"
  app_password = var.bitbucket_app_password
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `name` (String) Display name. Dokploy does not enforce a unique name.

### Optional

> **NOTE**: [Write-only arguments](https://developer.hashicorp.com/terraform/language/resources/ephemeral#write-only-arguments) are supported in Terraform 1.11 and later.

- `api_token` (String, Sensitive) Atlassian API token that belongs to `email`.
- `api_token_wo` (String, Sensitive, [Write-only](https://developer.hashicorp.com/terraform/language/resources/ephemeral#write-only-arguments)) Write-only form of `api_token`. Terraform keeps it out of the plan and the state. It needs Terraform 1.11 or later. Do not set it together with `api_token`. A new value reaches the server only when `api_token_wo_version` changes.
- `api_token_wo_version` (Number) Version of `api_token_wo`. Change it to send the current `api_token_wo` value to the server. It needs `api_token_wo`.
- `app_password` (String, Sensitive) Bitbucket app password that belongs to `username`. Atlassian has deprecated app passwords; prefer `email` with `api_token`.
- `app_password_wo` (String, Sensitive, [Write-only](https://developer.hashicorp.com/terraform/language/resources/ephemeral#write-only-arguments)) Write-only form of `app_password`. Terraform keeps it out of the plan and the state. It needs Terraform 1.11 or later. Do not set it together with `app_password`. A new value reaches the server only when `app_password_wo_version` changes.
- `app_password_wo_version` (Number) Version of `app_password_wo`. Change it to send the current `app_password_wo` value to the server. It needs `app_password_wo`.
- `email` (String) Atlassian account email, for the API-token shape. Dokploy validates it as an address and cannot clear it, so a change replaces the resource.
- `username` (String) Bitbucket username, for the app-password shape. Set `username` with `app_password` (or `app_password_wo`), or `email` with `api_token` (or `api_token_wo`).
- `workspace_name` (String) Bitbucket workspace whose repositories Dokploy lists. If you remove it from the configuration, the provider clears it.

### Read-Only

- `created_at` (String) Creation timestamp from the server.
- `git_provider_id` (String) Id of the generic git-provider record that owns this Bitbucket record.
- `id` (String) The `bitbucketId`. The `bitbucket.bitbucket_id` of an application or a compose references it.

## Import

Import is supported using the following syntax:

The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example:

```shell
# Import by the bitbucketId, the id that bitbucket.one takes.
terraform import dokploy_bitbucket_provider.main s7LQWsCjXLEgsT7rexTyL
```