dokploy_libsql (Resource)
A Dokploy libsql service: a distributed SQLite (sqld) database.
~> A replica (sqld_node = "replica") requires sqld_primary_url, and cannot set any external port. A non-replica (sqld_node unset or "primary") must NOT set sqld_primary_url. Dokploy rejects all three violations at apply time; this provider catches them earlier, at plan time.
Example Usage
resource "dokploy_libsql" "example" {
name = "edge-db"
environment_id = [for e in dokploy_project.example.environments : e.id if e.name == "production"][0]
database_user = "libsql"
database_password = var.db_password # use a sensitive variable
docker_image = "ghcr.io/tursodatabase/libsql-server:v0.24.32"
external_port = 8080
external_admin_port = 8081
external_grpc_port = 8082
}
Schema
Required
database_password(String, Sensitive) LibSQL database password.database_user(String) LibSQL database user.environment_id(String) Id of the environment this service lives in (seedokploy_project.environments).name(String) Display name of the libsql service.
Optional
command(String) Override the container 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").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 service. Defaults tofalse. Only meaningful together withnetwork_ids; applied on the next deploy.docker_image(String) LibSQL docker image, e.g.ghcr.io/tursodatabase/libsql-server:v0.24.32. That is also the server’s own default when this is omitted, and it is a real, pullable tag.enable_namespaces(Boolean) Enable sqld namespaces (multi-database mode). Defaults tofalse.env(String) Extra environment variables in Dokploy’s native multilineKEY=valueformat. Use Terraform sensitive variables for secret values. Omitting this attribute and setting it to “” are indistinguishable on read - both come back null. Use omission, not “”, to clear it.external_admin_port(Number) Host port to expose the libsql admin interface on. Not permitted whensqld_nodeisreplica.external_grpc_port(Number) Host port to expose the libsql gRPC replication interface on. Not permitted whensqld_nodeisreplica.external_port(Number) Host port to expose the libsql HTTP interface on. Not permitted whensqld_nodeisreplica.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 service to. Applied on the next deploy. Omit to keep only the defaultdokploy-network. An empty set is not valid - omit the attribute instead.replicas(Number) Number of container replicas to run. Defaults to1.server_id(String) Remote server to run the service on. Defaults to the Dokploy host.sqld_node(String) Topology role:primaryorreplica. A replica requiressqld_primary_url, and cannot have any external port.sqld_primary_url(String) URL of the primary sqld node. Required whensqld_nodeisreplica; rejected by the server wheneversqld_nodeis notreplica, including the default (primary).
Read-Only
app_name(String) Dokploy-internal app name. Always server-generated: the server derives it fromnameand appends a random suffix for uniqueness. It cannot be set directly.created_at(String) Creation timestamp (server-side).id(String) LibSQL service id.status(String) Service status reported by Dokploy.
Import
Import is supported using the following syntax:
The terraform import command can be used, for example:
terraform import dokploy_libsql.example <libsqlId>