dokploy_web_server_backup (Resource)
A scheduled backup of the Dokploy host. Dokploy dumps its own database and its configuration directory to an S3-compatible destination.
~> Dokploy lets more than one web-server backup exist. Each resource manages one backup. The provider does not run a backup on demand.
Example Usage
# Back up the Dokploy host every night. Dokploy dumps its own database and
# its configuration directory to the destination.
resource "dokploy_web_server_backup" "nightly" {
destination_id = dokploy_destination.backups.id
cron_expression = "0 3 * * *"
prefix = "dokploy/"
keep_latest_count = 14
}# Back up the Dokploy host to an S3 bucket. The destination and the backup
# are two resources. The backup refers to the destination by id.
resource "dokploy_destination" "host_backups" {
name = "host-backups"
provider_name = "AWS"
endpoint = "https://s3.eu-west-1.amazonaws.com"
bucket = "dokploy-host-backups"
region = "eu-west-1"
access_key_wo = var.s3_access_key
access_key_wo_version = 1
secret_access_key_wo = var.s3_secret_access_key
secret_access_key_wo_version = 1
}
resource "dokploy_web_server_backup" "host" {
destination_id = dokploy_destination.host_backups.id
cron_expression = "0 3 * * *"
prefix = "dokploy/"
keep_latest_count = 14
include_encryption_key = true
}Schema
Required
cron_expression(String) Standard five-field cron expression, for example0 3 * * *.destination_id(String) Id of thedokploy_destinationthat receives the backups.prefix(String) Key prefix inside the destination bucket, for exampledokploy/.
Optional
enabled(Boolean) Whether the backup runs. Defaults totrue. Dokploy leaves this field null for a record from the API alone, which is neither on nor off.include_encryption_key(Boolean) Include the encryption key in the backup. Defaults totrue, the value that Dokploy stores for a new backup. The provider always sends the field, because the Dokploy update endpoint storesfalsefor an omitted field.keep_latest_count(Number) Number of backups to keep. Omit it to keep all of them.
Read-Only
id(String) Backup 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:
import {
to = dokploy_web_server_backup.nightly
id = "b1a2b3c4d5e6f7g8h9i0j"
}The terraform import command can be used, for example:
terraform import dokploy_web_server_backup.nightly b1a2b3c4d5e6f7g8h9i0j