skip to content
wihan/dev
markdown
browse the dokploy docs

dokploy_compose (Data Source)

Looks up a Dokploy compose service by id, or by name within an environment, for example to attach a dokploy_domain or a dokploy_backup to a stack that Terraform does not manage:

terraform
data "dokploy_compose" "stalwart" {
  name           = "stalwart"
  environment_id = data.dokploy_environment.prod.id
}

The source blocks and service_networks of the resource are not part of the data source.

~> Dokploy does not enforce name uniqueness. If two compose services in the environment share a name, this data source fails instead of a guess. Look the record up by id in that case.

Example Usage

terraform
data "dokploy_compose" "example" {
  id = "your-compose-id"
}

# By name, within an environment.
data "dokploy_compose" "stalwart" {
  environment_id = data.dokploy_environment.production.id
  name           = "stalwart"
}

# Attach a domain to a stack that Terraform does not manage.
resource "dokploy_domain" "mail" {
  host         = "mail.example.com"
  compose_id   = data.dokploy_compose.stalwart.id
  service_name = "stalwart"
  port         = 8080
  https        = true
}

Schema

Optional

  • environment_id (String) Id of the environment to search. Required with name.
  • id (String) Compose service id. Set this attribute, or set both environment_id and name.
  • name (String) Exact display name. The lookup searches within environment_id and errors when zero or many compose services in the environment match.

Read-Only

  • app_name (String) Internal Dokploy app name.
  • auto_deploy (Boolean) Whether a source change starts a redeploy, or null.
  • command (String) Replacement deploy command, or null.
  • compose_path (String) Path to the compose file inside the repository.
  • compose_type (String) docker-compose or stack.
  • create_env_file (Boolean) Whether Dokploy writes the environment variables to a .env file.
  • created_at (String) Creation timestamp from the server.
  • description (String) Free-form description, or null.
  • enable_submodules (Boolean) Whether Dokploy clones git submodules.
  • env (String, Sensitive) Environment variables as multiline KEY=value lines, exactly as Dokploy stores them. The attribute is sensitive because it usually holds credentials that this provider did not write. The plan output redacts it, but the state stores it in plain text, like all Terraform data.
  • icon (String) Service icon for the Dokploy UI, or null.
  • randomize (Boolean) Whether Dokploy randomizes the generated resource names.
  • server_id (String) Id of the remote server that runs the service, or null for the Dokploy host.
  • source_type (String) Configured source type: github, gitlab, bitbucket, gitea, git, or raw.
  • status (String) Service status from Dokploy.
  • suffix (String) Suffix for the generated resource names, or null.
  • trigger_type (String) Git event that starts an auto-deploy: push or tag, or null.
  • watch_paths (List of String) Paths that limit an auto-deploy, or null.