dokploy_domain (Resource)
A domain (Traefik router rule) attached to a Dokploy application or compose service.
Example Usage
resource "dokploy_domain" "app" {
application_id = dokploy_application.frontend.id
host = "app.example.com"
port = 3000
https = true
certificate_type = "letsencrypt"
enabled = true
}
# A second hostname for the same application is a second domain resource.
# Disabled here as an example: `enabled = false` removes the route from
# Traefik but keeps the configuration, so it can be re-enabled later without
# re-entering certificates and paths.
resource "dokploy_domain" "app_www" {
application_id = dokploy_application.frontend.id
host = "www.app.example.com"
port = 3000
https = true
certificate_type = "letsencrypt"
enabled = false
}
Schema
Required
host(String) Hostname to serve, e.g.app.example.com. Dokploy does not enforce uniqueness, so the same host may be attached twice.
Optional
application_id(String) Id of the application this domain serves. Exactly one ofapplication_idorcompose_idmust be set. Changing it replaces the domain.certificate_type(String) Certificate strategy:letsencrypt,noneorcustom. Defaults to"none".compose_id(String) Id of the compose service this domain serves. Exactly one ofapplication_idorcompose_idmust be set. Changing it replaces the domain.custom_cert_resolver(String) Traefik certificate resolver name, forcertificate_type = "custom".custom_entrypoint(String) Traefik entrypoint to bind, instead of the default.enabled(Boolean) Serve this domain.falseremoves the route from Traefik but keeps the configuration, so it can be re-enabled without re-entering certificates and paths. Defaults totrue.forward_auth_enabled(Boolean) Route this domain through the configured forward-auth middleware. Defaults tofalse.https(Boolean) Serve over HTTPS. Defaults tofalse.internal_path(String) Path forwarded to the container. Defaults to"/".path(String) External path this rule matches. Defaults to"/".port(Number) Container port Traefik forwards to. Defaults to3000.service_name(String) Compose service to route to. Only meaningful withcompose_id.strip_path(Boolean) Strippathbefore forwarding. Defaults tofalse.
Read-Only
created_at(String) Creation timestamp (server-side).domain_type(String)applicationorcompose, derived from which ofapplication_id/compose_idis set.id(String) Domain id.middlewares(List of String) Traefik middlewares attached to this domain. Read-only: middlewares are created outside this provider, so a writable list would reference names Terraform cannot manage.unique_config_key(Number) Server-assigned ordering key. Dokploy ignores any value submitted for it.
Import
Import is supported using the following syntax:
The terraform import command can be used, for example:
# Domains are imported by their domain id.
terraform import dokploy_domain.app 8qZjMb4MS3y9kAEtbefgQ