# Dokploy Provider

Manage [Dokploy](https://dokploy.com) resources with Terraform:

- **Projects and environments**
- **Applications** from GitHub App, plain git, or Docker image sources
- **Compose services**: `docker-compose` projects and Docker Swarm stacks, from GitHub App, plain git, or an inline compose file
- **Databases**: PostgreSQL, MySQL, MariaDB, MongoDB, Redis and LibSQL
- **Routing**: domains, published ports, Traefik redirects, HTTP basic auth
- **Storage**: bind, volume and file mounts on any service
- **Backups**: S3-compatible destinations, scheduled database dumps and Docker volume archives
- **Scheduling**: cron jobs against a service, a remote server, or the Dokploy host

with deploy-on-change semantics and full import support throughout.

Works with Terraform >= 1.5 and OpenTofu. Developed and tested against
**Dokploy v0.30.2**; newer releases are exercised by the acceptance suite as
they ship, older ones are untested.

## Guides

- [Getting started](/docs/dokploy/guides/getting-started) - configure the provider and apply
  a first project, database, application and domain.
- [Adopting an existing Dokploy instance](/docs/dokploy/guides/adopting-an-existing-instance) -
  import a running server into state without recreating anything.
- [Deploy semantics](/docs/dokploy/guides/deploy-semantics) - `deploy_on_change`,
  `deployment_timeout`, and how deploys fail.
- [Secrets and sensitive values](/docs/dokploy/guides/secrets) - environment variables,
  database passwords, backup credentials.

## Before you start

Three things bite hardest, in order:

1. **API keys are rate-limited, and an exhausted budget returns `401`, not
   `429`.** A large apply can fail as an authentication error against a key
   that works fine for single requests. See
   [Getting started](/docs/dokploy/guides/getting-started#before-your-first-apply-api-key-rate-limits).
2. **`dokploy_application` and `dokploy_compose` own their whole service.**
   Applying either replaces anything changed in the Dokploy UI. Manage a
   service in Terraform or in the UI, not both. See
   [Adopting an existing Dokploy instance](/docs/dokploy/guides/adopting-an-existing-instance#decide-what-terraform-owns).
3. **MariaDB's and MongoDB's default `docker_image` does not exist on Docker
   Hub.** Set an explicit tag or every deploy fails. See
   [Deploy semantics](/docs/dokploy/guides/deploy-semantics#two-engines-whose-default-image-does-not-exist).

This provider is pre-1.0: breaking changes land in minor releases until
v1.0.0. Pin an exact version if you need stability.

## Example Usage

```terraform
provider "dokploy" {
  endpoint = "https://dokploy.example.com"
  # api_key sourced from the DOKPLOY_API_KEY environment variable
}
```

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

### Optional

- `api_key` (String, Sensitive) Dokploy API key, sent as the `x-api-key` header. Falls back to the `DOKPLOY_API_KEY` environment variable.
- `endpoint` (String) Base URL of the Dokploy server, e.g. `https://dokploy.example.com`. Falls back to the `DOKPLOY_ENDPOINT` environment variable.
- `insecure` (Boolean) Skip TLS certificate verification (for self-signed endpoints). Defaults to `false`.