skip to content
wihan.dev
view as markdown
browse the dokploy docs

dokploy_gitea_provider (Resource)

A Gitea connection (Git > Gitea): the OAuth2 application that lets Dokploy list and clone repositories. Applications and composes then use the gitea source block with this record’s id.

~> A person must authorize the application once in a browser. Terraform stores the OAuth2 application credentials. Until someone opens Git > Gitea in the Dokploy UI and completes the authorization, Dokploy holds no access token, the dokploy_gitea_provider data source reports is_configured = false, and a deploy from this provider fails.

~> Dokploy stores and returns client_secret in cleartext. The attribute is sensitive, so Terraform does not print it, but anyone with API access to the server can read it. The client_secret_wo companion keeps it out of the Terraform state.

Example Usage

terraform
# Register the OAuth2 application that you created in Gitea
# (Settings > Applications). The default redirect_uri matches the provider's
# endpoint; register the same URI in Gitea.
resource "dokploy_gitea_provider" "main" {
  name      = "gitea"
  gitea_url = "https://gitea.example.com"
  client_id = var.gitea_client_id

  # Write-only: Terraform 1.11 or later. Change the version to send a new secret.
  client_secret_wo         = var.gitea_client_secret
  client_secret_wo_version = 1
}

# After the apply, open Git > Gitea in Dokploy and authorize the application
# once. Until then the provider holds no access token.

Schema

Required

  • client_id (String) Client ID of the OAuth2 application that you created in Gitea.
  • gitea_url (String) URL of the Gitea instance, for example https://gitea.example.com.
  • name (String) Display name. Dokploy does not enforce a unique name.

Optional

NOTE: Write-only arguments are supported in Terraform 1.11 and later.

  • client_secret (String, Sensitive) Client secret of the OAuth2 application. Set this attribute or client_secret_wo.
  • client_secret_wo (String, Sensitive, Write-only) Write-only form of client_secret. Terraform keeps it out of the plan and the state. It needs Terraform 1.11 or later. Set exactly one of client_secret and client_secret_wo. A new value reaches the server only when client_secret_wo_version changes.
  • client_secret_wo_version (Number) Version of client_secret_wo. Change it to send the current client_secret_wo value to the server. It needs client_secret_wo.
  • gitea_internal_url (String) URL that the Dokploy server uses to reach Gitea when it differs from gitea_url, for example an address on a private network. If you remove it from the configuration, the provider clears it.
  • redirect_uri (String) Redirect URI of the OAuth2 application. Defaults to <endpoint>/api/providers/gitea/callback, built from the provider’s endpoint. Register the same URI in Gitea.
  • scopes (String) OAuth2 scopes that Dokploy requests, comma-separated. Defaults to repo,repo:status,read:user,read:org.
  • verify_connection (Boolean) Test the connection with gitea.testConnection after the provider creates or updates the record, because the endpoint takes the id of a stored record. If the test fails, the apply fails with the server message, but the record stays on the server. After a failed create, Terraform marks the resource as tainted. The default is no check: null and false both skip the test. Dokploy stores no value for this attribute, so terraform import leaves it null. Gitea answers the test only after you authorize the OAuth2 application in the Dokploy UI. A new record has no access token, so a test on the first apply always fails.

Read-Only

  • created_at (String) Creation timestamp from the server.
  • git_provider_id (String) Id of the generic git-provider record that owns this Gitea record.
  • id (String) The giteaId. The gitea.gitea_id of an application or a compose references it.

Import

Import is supported using the following syntax:

In Terraform v1.5.0 and later, the import block can be used with the id attribute, for example:

terraform
# Import by the giteaId, the id that gitea.one takes.
import {
  to = dokploy_gitea_provider.main
  id = "X_9OsNZiMvNvaqGIJJzpf"
}

The terraform import command can be used, for example:

shell
terraform import dokploy_gitea_provider.main X_9OsNZiMvNvaqGIJJzpf