sylve_jail (Resource)

A FreeBSD or Linux jail managed by Sylve. Structurally parallel to sylve_vm: covers the jail object itself (CPU/memory/boot options) and its base filesystem/switch, set at creation time. Additional storage/network attachments, cloud-init-equivalent metadata, and lifecycle hooks are not yet covered – see the provider’s dev notes.

Example Usage

resource "sylve_jail" "example" {
  ctid = 200 # 1-9999, unique, chosen by you -- never auto-assigned
  name = "example-jail"
  type = "freebsd" # or "linux"

  # pool/base/switch_name are all required by Sylve itself for a real
  # create, but write-only in this resource (not read back), so declare
  # them for a fresh create and OMIT them entirely if you're importing
  # an existing jail you don't intend to recreate:
  pool        = "tank"
  base        = sylve_download.freebsd_base.uuid # a download with utype = "base-rootfs", already extracted
  switch_name = "lan"                            # or "none" for no networking, or "inherit"

  cores  = 2
  memory = 1073741824 # 1GiB, in BYTES -- not MiB
}

Schema

Required

  • ctid (Number) Sylve’s container ID for this jail, 1-9999, unique across jails. Like sylve_vm’s rid, this is NOT auto-assigned – ValidateCreate rejects ctid <= 0 outright with invalid_ct_id. The caller must pick one.
  • name (String) Jail name.
  • type (String) “freebsd” or “linux”. Immutable.

Optional

  • additional_options (String) Extra raw jail.conf options. Write-only, immutable.
  • base (String) UUID of a sylve_download whose utype is “base-rootfs” and which has already been extracted (automatic_extraction = true on that download). Required by Sylve itself, but not enforced client-side – see the comment above. Write-only, immutable.
  • clean_environment (Boolean) Start the jail with a clean environment (clearenv). Write-only, immutable.
  • cores (Number) CPU core limit. No enforced minimum (unlike sylve_vm’s cpu_* attributes). Changing it updates in place via SetJailCPU.
  • description (String) Free-text description shown in the Sylve UI.
  • devfs_ruleset (String) devfs ruleset name/number. Write-only, immutable.
  • fstab (String) Extra fstab content. Write-only, immutable (Sylve has a dedicated ModifyFstab endpoint this provider doesn’t call yet).
  • hostname (String) Jail hostname. Defaults to Sylve’s own default (empty in config becomes server-assigned) if unset.
  • memory (Number) Memory limit in BYTES, same convention as sylve_vm’s ram (confirmed against source, not MiB despite an initial wrong guess while writing this resource – see the provider’s dev notes). Changing it updates in place via SetJailMemory.
  • pool (String) ZFS pool the jail’s root filesystem is created on, e.g. “tank”. Required by Sylve itself, but not enforced client-side – see the comment above. Write-only, immutable.
  • resolv_conf (String) Jail-internal resolv.conf content. Write-only, immutable (Sylve has a dedicated ModifyResolvConf endpoint this provider doesn’t call yet).
  • resource_limits (Boolean) Whether cores/memory limits are actually enforced (via rctl). Write-only: no dedicated update endpoint found; changing it recreates the jail.
  • start_at_boot (Boolean) Start this jail automatically when Sylve/the host boots. Write-only, changing it recreates the jail (same gap as sylve_vm’s own start_at_boot).
  • start_order (Number) Boot order among auto-started guests. Must be >= 0. Write-only, changing it recreates the jail.
  • switch_name (String) Name of an existing Sylve network switch to attach to, or the literal string “none” (no network) or “inherit” (inherit the host’s own IPv4/IPv6). Required by Sylve itself, but not enforced client-side – see the comment above. Write-only, immutable.

Read-Only

  • id (String) Terraform resource identity – the jail’s CTID as a string.

Not published on the Terraform Registry yet -- see the repo's README for local dev_overrides usage in the meantime.

This site uses Just the Docs, a documentation theme for Jekyll.