dokploy_network (Resource)
A Docker network managed by Dokploy, for attaching services to extra networks beyond the default dokploy-network (see network_ids on dokploy_application and the database resources, and service_networks on dokploy_compose).
~> Networks are immutable. Dokploy exposes no update endpoint, so changing any attribute replaces the network. Attached services keep working until their next deploy; re-attach them to the replacement id (a dokploy_network.<name>.id reference does this automatically) and redeploy.
~> Deleting an attached network does not fail and does not detach it. network.remove succeeds even while an application still references the network in its network_ids; the reference is left dangling until that application is next updated or redeployed.
-> A network created outside Dokploy (e.g. docker network create) has no Dokploy id. Import it once in the Dokploy UI (Networks -> Import), then read it with the dokploy_network data source or terraform import.
Example Usage
resource "dokploy_network" "backend" {
name = "backend-net"
# Networks are immutable: changing any attribute replaces the network.
# attachable = true
# mtu = 1400
# ipam = {
# config = [{ subnet = "172.28.0.0/16" }]
# }
}
# Attach a service to it (applies on the service's next deploy):
# resource "dokploy_application" "api" {
# # ...
# network_ids = [dokploy_network.backend.id]
# }
Schema
Required
name(String) Network name. Changing it replaces the network.
Optional
attachable(Boolean) Allow manual container attachment (overlay networks).driver(String) Network driver:bridgeoroverlay. Defaults tobridge.enable_ipv4(Boolean) Enable IPv4 on the network.enable_ipv6(Boolean) Enable IPv6 on the network.internal(Boolean) Restrict external access to the network.ipam(Attributes) Custom IP address management. Unset leaves Docker’s defaults. (see below for nested schema)mtu(Number) MTU for the network, 68-65535. Unset leaves Docker’s default.server_id(String) Id of the remote server to create the network on. Unset targets the Dokploy host.
Read-Only
created_at(String) Creation timestamp (server-side).id(String) Network id.
Nested Schema for ipam
Optional:
config(Attributes List) Address pools. (see below for nested schema)driver(String) IPAM driver, e.g.default.
Nested Schema for ipam.config
Optional:
gateway(String) Gateway address for the pool.ip_range(String) Sub-range to allocate from, in CIDR form.subnet(String) Pool subnet in CIDR form, e.g.172.28.0.0/16.
Import
Import is supported using the following syntax:
The terraform import command can be used, for example:
# Networks created in the Dokploy UI (including UI-imported Docker networks)
# can be adopted by id:
terraform import dokploy_network.backend <network-id>