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:
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
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 withname.id(String) Compose service id. Set this attribute, or set bothenvironment_idandname.name(String) Exact display name. The lookup searches withinenvironment_idand 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-composeorstack.create_env_file(Boolean) Whether Dokploy writes the environment variables to a.envfile.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 multilineKEY=valuelines, 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, orraw.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:pushortag, or null.watch_paths(List of String) Paths that limit an auto-deploy, or null.