wihan/dev

docs /dokploy / resources

markdown
browse the dokploy docs

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 of application_id or compose_id must be set. Changing it replaces the domain.
  • certificate_type (String) Certificate strategy: letsencrypt, none or custom. Defaults to "none".
  • compose_id (String) Id of the compose service this domain serves. Exactly one of application_id or compose_id must be set. Changing it replaces the domain.
  • custom_cert_resolver (String) Traefik certificate resolver name, for certificate_type = "custom".
  • custom_entrypoint (String) Traefik entrypoint to bind, instead of the default.
  • enabled (Boolean) Serve this domain. false removes the route from Traefik but keeps the configuration, so it can be re-enabled without re-entering certificates and paths. Defaults to true.
  • forward_auth_enabled (Boolean) Route this domain through the configured forward-auth middleware. Defaults to false.
  • https (Boolean) Serve over HTTPS. Defaults to false.
  • 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 to 3000.
  • service_name (String) Compose service to route to. Only meaningful with compose_id.
  • strip_path (Boolean) Strip path before forwarding. Defaults to false.

Read-Only

  • created_at (String) Creation timestamp (server-side).
  • domain_type (String) application or compose, derived from which of application_id / compose_id is 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