dokploy_application (Resource)
An application service in a Dokploy environment: its source, build settings, and environment variables managed as a single resource.
~> Terraform owns the whole application. Applying this resource rewrites the application’s source, build and environment configuration wholesale, so any of those settings changed in the Dokploy UI is replaced on the next apply. Manage an application either in Terraform or in the UI, not both.
Example Usage
resource "dokploy_application" "example" {
name = "web"
environment_id = [for e in dokploy_project.example.environments : e.id if e.name == "production"][0]
docker = {
image = "traefik/whoami:v1.10"
}
env = <<-EOT
PORT=80
EOT
# Attach to extra Docker networks. Applied on the next deploy. A bare id
# would not apply for other users, so this stays commented out - replace
# it with a real network id from your own instance before you uncomment it.
# network_ids = ["<dokploy-network-id>"]
}
Schema
Required
environment_id(String) Id of the environment this application lives in (seedokploy_project.environments).name(String) Display name of the application.
Optional
app_name(String) Dokploy-internal app name; generated by the server when omitted.args(List of String) Arguments passed to the container command.auto_deploy(Boolean) Redeploy automatically when Dokploy receives a webhook for the configured branch or tag.build(Attributes) Build settings; server default is nixpacks. (see below for nested schema)build_args(String) Build-time arguments in the same multiline format.build_secrets(String, Sensitive) Build-time secrets in the same multilineKEY=valueformat, mounted during the build and not baked into the image. Omitting it clears any value set in the Dokploy UI; omission and""are indistinguishable on read, so use omission to clear.command(String) Override the container entrypoint command.cpu_limit(String) Hard CPU limit, Docker-style (e.g."0.5"). A string, not a number.cpu_reservation(String) Reserved CPU, Docker-style (e.g."0.25").create_env_file(Boolean) Write the environment variables to a.envfile in the build context. Defaults totrue, matching Dokploy’s own default for a new application.deploy_on_change(Boolean) Deploy after create and after changes to deploy-triggering attributes. Defaults totrue.deployment_timeout(String) How long to wait for a triggered deployment to reach a terminal status, as a Go duration string. Defaults to"15m". On timeout the apply fails but the server-side deployment keeps running.description(String) Free-form description.detach_dokploy_network(Boolean) Detach the shareddokploy-networkfrom this application. Defaults tofalse. Only meaningful together withnetwork_ids; applied on the next deploy.docker(Attributes) Docker image source. (see below for nested schema)enable_submodules(Boolean) Check out git submodules when cloning. Applies to thegithubandgitsources; ignored fordocker.env(String) Environment variables in Dokploy’s native multilineKEY=valueformat. Use Terraform sensitive variables for secret values. Setting this also clears the application’s build secrets in Dokploy, which this resource does not expose.git(Attributes) Custom git source (any reachable repo over https/ssh). Exactly one ofgithub,git, ordockermust be set. (see below for nested schema)github(Attributes) GitHub App source. Exactly one ofgithub,git, ordockermust be set. The GitHub provider (github_id) is configured in Dokploy (Git > GitHub) — a documented manual prerequisite. (see below for nested schema)memory_limit(String) Hard memory limit, Docker-style (e.g."512m").memory_reservation(String) Reserved memory, Docker-style (e.g."256m").network_ids(Set of String) Ids of Docker networks (Dokploy network records) to attach this application to. Applied on the next deploy. Omit to keep only the defaultdokploy-network. An empty set is not valid - omit the attribute instead.registry_id(String) Id of a Dokploy registry to push built images to. This provider has no registry resource yet; supply the id as a literal.replicas(Number) Number of container replicas to run. Dokploy’s schema has no null variant for this field, so it always has a concrete value.server_id(String) Remote server to run the application on. Defaults to the Dokploy host.watch_paths(List of String) Glob paths that trigger an auto-deploy when changed. Applies to thegithubandgitsources; ignored fordocker. Omitting it clears any value set in the Dokploy UI.
Read-Only
created_at(String) Creation timestamp (server-side).id(String) Application id.status(String) Application status reported by Dokploy.
Nested Schema for build
Required:
type(String) Build type: one ofnixpacks,dockerfile,heroku_buildpacks,paketo_buildpacks,static,railpack. Note thatheroku_buildpacksandrailpacktake a builder version in Dokploy which this provider does not expose; it is always sent unset, so those two build types always use the server’s default builder version and any version chosen in the Dokploy UI is reset on apply.
Optional:
build_stage(String) Target stage for multi-stage builds.context_path(String) Docker build context path.dockerfile(String) Dockerfile path (build typedockerfile).heroku_version(String) Builder version for build typeheroku_buildpacks. Omit to use the server’s default.is_static_spa(Boolean) Serve the build output as a single-page application, rewriting unknown paths to the index document.publish_directory(String) Publish directory (build typestatic).railpack_version(String) Builder version for build typerailpack. Omit to use the server’s default.
Nested Schema for docker
Required:
image(String) Image reference, e.g.nginx:1.27.
Optional:
password(String, Sensitive) Registry password for private images.registry_url(String) Registry URL for private registries.username(String) Registry username for private images.
Nested Schema for git
Required:
branch(String) Branch to deploy.url(String) Clone URL.
Optional:
build_path(String) Path inside the repo to build from.ssh_key_id(String) Id of a Dokploy SSH key for private repos.
Nested Schema for github
Required:
branch(String) Branch to deploy.github_id(String) Id of the GitHub provider configured in Dokploy.owner(String) Repository owner (user or org).repository(String) Repository name.
Optional:
build_path(String) Path inside the repo to build from.trigger_type(String) What triggers an auto-deploy:pushortag. Dokploy writes this field on every source save whether or not the request carries it, so it always has a concrete value; it cannot be left unmanaged.
Import
Import is supported using the following syntax:
The terraform import command can be used, for example:
terraform import dokploy_application.example <applicationId>