skip to content
wihan.dev
view as markdown
browse the dokploy docs

dokploy_patch (Resource)

A file change that Dokploy applies to the repository of an application or a compose service before each build: it creates, replaces, or deletes one file. A change applies at the next deploy.

~> Each file path can have one patch for each service.

Example Usage

terraform
# Replace a file in the repository of an application before each build.
resource "dokploy_patch" "config" {
  application_id = dokploy_application.web.id
  file_path      = "config/app.yaml"
  content        = file("${path.module}/app.yaml")
}

# Remove a file from the repository of a compose service before each build.
resource "dokploy_patch" "no_override" {
  compose_id = dokploy_compose.stack.id
  file_path  = "docker-compose.override.yml"
  type       = "delete"
}

Schema

Required

  • file_path (String) Path of the file, relative to the repository root, for example config/app.yaml.

Optional

  • application_id (String) Id of the application whose repository the patch changes. Set exactly one of application_id or compose_id. A change replaces the patch.
  • compose_id (String) Id of the compose service whose repository the patch changes. Set exactly one of application_id or compose_id. A change replaces the patch.
  • content (String) Full content of the file. Defaults to "", the value for a delete patch. Dokploy adds a final newline to a non-empty content when it updates the patch.
  • enabled (Boolean) Apply the patch at the next build. Defaults to true.
  • type (String) What the patch does to the file: create adds it, update replaces its content, and delete removes it. Defaults to update.

Read-Only

  • created_at (String) Creation timestamp from the server.
  • id (String) Patch id.

Import

Import is supported using the following syntax:

In Terraform v1.5.0 and later, the import block can be used with the id attribute, for example:

terraform
import {
  to = dokploy_patch.config
  id = "5lKDN_oX5hVG5balpQIKv"
}

The terraform import command can be used, for example:

shell
terraform import dokploy_patch.config 5lKDN_oX5hVG5balpQIKv