A Terraform provider for Dokploy

Plugin-framework provider covering projects, environments, applications,
Compose stacks, managed databases, domains, mounts, ports, redirects,
basic auth, registries, SSH keys, certificates and backup destinations,
over Dokploy's tRPC-over-REST API.

The shim package exposes the provider to other Go modules, which is how
pulumi-dokploy bridges it.
This commit is contained in:
2026-08-09 12:17:26 +03:00
commit a6d8aa8b52
160 changed files with 24260 additions and 0 deletions

View File

@@ -0,0 +1,186 @@
variable "name" {
description = "Display name of the application."
type = string
}
variable "description" {
description = "Free-form description shown in the Dokploy UI."
type = string
default = null
}
variable "environment_id" {
description = "Environment the service belongs to. Usually dokploy_project.<x>.default_environment_id."
type = string
}
variable "server_id" {
description = "Remote server to deploy on. Leave null to use the Dokploy host itself."
type = string
default = null
}
variable "service_source" {
description = <<-DESC
Where the service comes from. Set `type` to one of `docker`, `github` or `git`
and populate the matching fields; the rest are ignored.
DESC
type = object({
type = string
# type = "docker"
image = optional(string)
registry_username = optional(string)
registry_password = optional(string)
registry_url = optional(string)
# type = "github"
github_id = optional(string)
owner = optional(string)
repository = optional(string)
# type = "git"
url = optional(string)
ssh_key_id = optional(string)
# shared by the git-backed types
branch = optional(string)
build_path = optional(string)
})
validation {
condition = contains(["docker", "github", "git"], var.service_source.type)
error_message = "service_source.type must be one of: docker, github, git."
}
validation {
condition = var.service_source.type != "docker" || var.service_source.image != null
error_message = "service_source.image is required when source.type is \"docker\"."
}
validation {
condition = var.service_source.type != "github" || (
var.service_source.owner != null && var.service_source.repository != null && var.service_source.branch != null
)
error_message = "service_source.owner, source.repository and source.branch are required when source.type is \"github\"."
}
validation {
condition = var.service_source.type != "git" || (var.service_source.url != null && var.service_source.branch != null)
error_message = "service_source.url and source.branch are required when source.type is \"git\"."
}
}
variable "build_type" {
description = "How the application is built. Ignored when the source is a prebuilt Docker image."
type = string
default = null
validation {
condition = var.build_type == null || contains(
["dockerfile", "heroku_buildpacks", "paketo_buildpacks", "nixpacks", "static", "railpack"],
coalesce(var.build_type, "nixpacks")
)
error_message = "build_type must be one of: dockerfile, heroku_buildpacks, paketo_buildpacks, nixpacks, static, railpack."
}
}
variable "dockerfile" {
description = "Path to the Dockerfile, when build_type is \"dockerfile\"."
type = string
default = null
}
variable "env" {
description = "Runtime environment variables in KEY=value form, one per line."
type = string
default = null
sensitive = true
}
variable "build_args" {
description = "Docker build arguments in KEY=value form, one per line."
type = string
default = null
}
variable "auto_deploy" {
description = "Redeploy automatically when the configured Git trigger fires."
type = bool
default = null
}
variable "replicas" {
description = "Number of replicas to run."
type = number
default = null
}
variable "resources" {
description = "Container resource reservations and limits, as Docker-style strings such as \"512m\" or \"1.5\"."
type = object({
memory_reservation = optional(string)
memory_limit = optional(string)
cpu_reservation = optional(string)
cpu_limit = optional(string)
})
default = {}
}
variable "domains" {
description = "Domains routed to this service through Traefik."
type = list(object({
host = string
port = optional(number, 3000)
path = optional(string, "/")
https = optional(bool, true)
certificate_type = optional(string, "letsencrypt")
strip_path = optional(bool, false)
internal_path = optional(string, "/")
}))
default = []
}
variable "published_ports" {
description = "Ports published directly on the host, bypassing Traefik."
type = list(object({
published_port = number
target_port = number
protocol = optional(string, "tcp")
publish_mode = optional(string, "host")
}))
default = []
}
variable "mounts" {
description = "Volumes, bind mounts and config files attached to the service."
type = list(object({
mount_path = string
type = optional(string, "volume")
volume_name = optional(string)
host_path = optional(string)
file_path = optional(string)
content = optional(string)
}))
default = []
}
variable "basic_auth" {
description = "HTTP basic auth credentials protecting the service's domains. Null disables it."
type = object({
username = string
password = string
})
default = null
sensitive = true
}
variable "redirects" {
description = "Traefik redirect rules attached to the service."
type = list(object({
regex = string
replacement = string
permanent = optional(bool, true)
}))
default = []
}