skip to content
wihan/dev
markdown
browse the dokploy docs

dokploy_domain (Data Source)

Looks up a domain, a Traefik router rule, that already exists on a Dokploy application or compose service.

terraform
data "dokploy_domain" "mail" {
  host       = "mail.example.com"
  compose_id = data.dokploy_compose.stalwart.id
}

~> Dokploy does not enforce host uniqueness: the same host can attach to more than one domain. Set application_id or compose_id to limit the search to one service. Without a filter, the lookup reads the domains of every service in the organization, one request per service. If more than one domain matches, this data source fails instead of a guess. Look the record up by id in that case.

Example Usage

terraform
data "dokploy_domain" "example" {
  id = "your-domain-id"
}

# By host, limited to one compose service. Hosts are not unique in Dokploy,
# so a filter keeps the lookup unambiguous.
data "dokploy_domain" "mail" {
  host       = "mail.example.com"
  compose_id = data.dokploy_compose.stalwart.id
}

# By host alone. The lookup reads the domains of every service in the
# organization and fails if more than one carries the host.
data "dokploy_domain" "www" {
  host = "www.example.com"
}

Schema

Optional

  • application_id (String) Id of the application that the domain serves. As a filter, it limits a host lookup to that application’s domains.
  • compose_id (String) Id of the compose service that the domain serves. As a filter, it limits a host lookup to that service’s domains.
  • host (String) Hostname that the domain serves, for example app.example.com. Set exactly one of id or host.
  • id (String) Domain id. Set it for a lookup by id, or leave it unset and set host.

Read-Only

  • certificate_type (String) Certificate strategy: letsencrypt, none, or custom.
  • created_at (String) Creation timestamp from the server.
  • custom_cert_resolver (String) Traefik certificate resolver name, or null.
  • custom_entrypoint (String) Traefik entrypoint, or null for the default.
  • domain_type (String) application or compose.
  • enabled (Boolean) Whether Traefik serves the domain.
  • forward_auth_enabled (Boolean) Whether the domain routes through the forward-auth middleware.
  • https (Boolean) Whether the domain is served over HTTPS.
  • internal_path (String) Path that Traefik forwards to the container.
  • middlewares (List of String) Traefik middlewares on the domain.
  • path (String) External path that the rule matches.
  • port (Number) Container port that Traefik forwards to.
  • service_name (String) Compose service that the domain routes to, or null.
  • strip_path (Boolean) Whether Traefik strips path before the forward.
  • unique_config_key (Number) Ordering key that the server assigns.