Skip to content

Lab

The lab resource defines the main configuration for your lab, including metadata, settings, layout, and content structure. This is equivalent to what was previously called a “track” in legacy formats.

resource "lab" "name" {
title = "My Lab"
description = "A brief description of what this lab teaches"
layout = resource.layout.two_column
content {
chapter "introduction" {
title = "Getting Started"
page "welcome" {
reference = resource.page.welcome
}
}
}
}
resource "lab" "name" {
title = "My Lab"
description = "A comprehensive description of the lab"
tags = ["docker", "kubernetes", "devops"]
settings {
theme = "modern_dark"
timelimit {
duration = "30m"
extend = "5m"
show_timer = true
}
idle {
enabled = true
timeout = "10m"
show_warning = true
}
controls {
show_stop = true
}
}
layout = resource.layout.default
content {
title = "Lab Instructions"
chapter "chapter1" {
title = "Introduction"
layout = resource.layout.single_column
page "page1" {
title = "Welcome"
layout = resource.layout.two_column
reference = resource.page.welcome
}
}
}
}
lab
├─ title, description, tags (metadata)
├─ layout (reference to default layout)
├─ settings
│ ├─ theme
│ ├─ timelimit
│ │ ├─ duration, extend, show_timer
│ ├─ idle
│ │ ├─ enabled, timeout, show_warning
│ └─ controls
│ └─ show_stop
└─ content
├─ title
└─ chapters[]
├─ title, layout (optional override)
└─ pages[]
├─ title (optional override), layout (optional override)
└─ reference (to page resource)

lab

FieldRequiredTypeDescription
titlestringThe title of the lab
descriptionstringA description of the lab
layoutreference to layoutDefault layout for the lab
tagslist(string)Tags that describe the lab. Defaults to empty list.
settingsblockLab configuration settings with default settings applied
contentblockInstructional content structure

lab → settings

Configuration for lab behavior, appearance, and constraints.

FieldRequiredTypeDescription
themestringUI theme: “modern_dark” or “original”. Defaults to “modern_dark”.
timelimitblockTime limit configuration with default timelimit applied
idleblockIdle timeout configuration with default idle applied
controlsblockUI control configuration with default controls applied

labsettings → timelimit

Configures time limits and extensions for the lab session. Controls how long participants have to complete the lab and whether they can request additional time.

FieldRequiredTypeDescription
durationstringMaximum lab duration (Go duration format). Defaults to “15m”.
extendstringExtension time allowed (Go duration format). Defaults to “0”.
show_timerboolWhether to show the timer to users. Defaults to true.

labsettings → idle

Configures automatic lab termination when participants are inactive. Helps manage resource usage by stopping labs that aren’t being actively used.

FieldRequiredTypeDescription
enabledboolEnable idle timeout. Defaults to true.
timeoutstringIdle timeout duration (Go duration format). Defaults to “5m”.
show_warningboolShow idle timeout warning to users. Defaults to true.

labsettings → controls

Configures which UI controls are available to participants during the lab session. Controls user interaction options and available actions.

FieldRequiredTypeDescription
show_stopboolShow the stop lab button to users. Defaults to true.

lab → content

Defines the instructional content organization.

FieldRequiredTypeDescription
titlestringTitle for the content tab
chaptersblockChapter definitions (repeatable)

labcontent → chapters

Defines a logical grouping of related pages within the lab. Chapters provide structure and organization for the instructional content, allowing participants to understand the learning progression.

FieldRequiredTypeDescription
sluglabelChapter identifier
titlestringChapter display title
layoutreference to layoutLayout override for this chapter. Defaults to lab default.
pagesblockPages within the chapter (repeatable)

labcontentchapters → pages

Defines individual instructional pages within a chapter. Pages contain the actual content (markdown files) that participants read and interact with during the lab.

FieldRequiredTypeDescription
sluglabelPage identifier
titlestringPage title override. Defaults to value from page resource.
layoutreference to layoutLayout override for this page. Defaults to chapter default.
referencereference to pageReference to the page resource

The following defaults are applied automatically:

settings {
theme = "modern_dark"
timelimit {
duration = "15m"
extend = "0"
show_timer = true
}
idle {
enabled = true
timeout = "5m"
show_warning = true
}
controls {
show_stop = true
}
}
  • Theme validation: Must be “modern_dark” or “original”
  • Duration formats: Must be valid Go duration strings (e.g., “15m”, “1h30m”, ”45s”)
  • Layout inheritance: Page layouts inherit from chapters, chapters inherit from lab default
  • Content structure: Pages must reference valid page resources
resource "lab" "basic" {
title = "Docker Basics"
description = "Learn Docker fundamentals"
layout = resource.layout.two_column
content {
chapter "intro" {
title = "Introduction"
page "welcome" {
reference = resource.page.welcome
}
}
}
}
resource "lab" "advanced" {
title = "Kubernetes Deep Dive"
description = "Advanced Kubernetes concepts and practices"
tags = ["kubernetes", "advanced", "devops"]
settings {
theme = "original"
timelimit {
duration = "2h"
extend = "30m"
show_timer = true
}
idle {
timeout = "15m"
}
}
layout = resource.layout.three_column
content {
title = "Course Material"
chapter "setup" {
title = "Environment Setup"
page "requirements" {
reference = resource.page.requirements
}
page "installation" {
reference = resource.page.installation
}
}
chapter "basics" {
title = "Kubernetes Basics"
layout = resource.layout.two_column
page "pods" {
reference = resource.page.pods
}
page "services" {
reference = resource.page.services
}
}
}
}

Layouts are inherited in the following order (most specific wins):

  1. Page-level layout (highest priority)
  2. Chapter-level layout
  3. Lab-level layout (lowest priority)
resource "lab" "example" {
layout = resource.layout.default # Applied to all pages by default
content {
chapter "intro" {
layout = resource.layout.two_column # Overrides lab default for all pages in this chapter
page "welcome" {
reference = resource.page.welcome # Uses chapter layout
}
page "setup" {
layout = resource.layout.three_column # Overrides chapter layout for this page only
reference = resource.page.setup
}
}
}
}
  1. Descriptive Titles: Use clear, descriptive titles for labs and chapters
  2. Appropriate Timeframes: Set realistic time limits based on lab complexity
  3. Tag Consistently: Use consistent tags across labs for better organization
  4. Layout Hierarchy: Use layout inheritance to minimize repetition
  5. Chapter Organization: Group related pages into logical chapters