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.
Use Cases
Section titled “Use Cases”As a lab author, you use the lab resource to define the overall lab experience:
- Learning Structure: Organize content into logical chapters and pages that guide users through progressive learning experiences
- Time Management: Configure time limits, extensions, and idle behavior to ensure appropriate pacing for learning objectives
- Interactive Learning: Structure labs to include tasks, quizzes, and other interactive elements that validate learning outcomes
The lab resource serves as the foundation that ties together all other lab components into a cohesive learning experience.
HCL Syntax
Section titled “HCL Syntax”Basic Syntax
Section titled “Basic Syntax”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 } } }}Full Syntax
Section titled “Full Syntax”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 } } }}Resource Structure
Section titled “Resource Structure”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)Fields
Section titled “Fields”Core Configuration
Section titled “Core Configuration”| Field | Required | Type | Description |
|---|---|---|---|
title | ✓ | string | The title of the lab |
description | ✓ | string | A description of the lab |
layout | ✓ | reference to layout | Default layout for the lab |
tags | list(string) | Tags that describe the lab. Defaults to empty list. | |
settings | block | Lab configuration settings with default settings applied | |
content | block | Instructional content structure |
Settings Configuration
Section titled “Settings Configuration”lab → settings
Configuration for lab behavior, appearance, and constraints.
| Field | Required | Type | Description |
|---|---|---|---|
theme | string | UI theme: “modern_dark” or “original”. Defaults to “modern_dark”. | |
timelimit | block | Time limit configuration with default timelimit applied | |
idle | block | Idle timeout configuration with default idle applied | |
controls | block | UI control configuration with default controls applied |
Timelimit Block
Section titled “Timelimit Block”Configures time limits and extensions for the lab session. Controls how long users have to complete the lab and whether they can request additional time.
| Field | Required | Type | Description |
|---|---|---|---|
duration | string | Maximum lab duration (Go duration format). Defaults to “15m”. | |
extend | string | Extension time allowed (Go duration format). Defaults to “0”. | |
show_ | bool | Whether to show the timer to users. Defaults to true. |
Idle Block
Section titled “Idle Block”Configures automatic lab termination when users are inactive. Helps manage resource usage by stopping labs that aren’t being actively used.
| Field | Required | Type | Description |
|---|---|---|---|
enabled | bool | Enable idle timeout. Defaults to true. | |
timeout | string | Idle timeout duration (Go duration format). Defaults to “5m”. | |
show_ | bool | Show idle timeout warning to users. Defaults to true. |
Controls Block
Section titled “Controls Block”Configures which UI controls are available to users during the lab session. Controls user interaction options and available actions.
| Field | Required | Type | Description |
|---|---|---|---|
show_ | bool | Show the stop lab button to users. Defaults to true. |
Content Structure
Section titled “Content Structure”lab → content
Defines the instructional content organization.
| Field | Required | Type | Description |
|---|---|---|---|
title | string | Title for the content tab | |
chapters | block | Chapter definitions (repeatable) |
Chapter Block
Section titled “Chapter Block”Defines a logical grouping of related pages within the lab. Chapters provide structure and organization for the instructional content, allowing users to understand the learning progression.
| Field | Required | Type | Description |
|---|---|---|---|
slug | ✓ | label | Chapter identifier |
title | ✓ | string | Chapter display title |
layout | reference to layout | Layout override for this chapter. Defaults to lab default. | |
pages | block | Pages within the chapter (repeatable) |
Page Block
Section titled “Page Block”lab → content → chapters → pages
Defines individual instructional pages within a chapter. Pages contain the actual content (markdown files) that users read and interact with during the lab.
| Field | Required | Type | Description |
|---|---|---|---|
slug | ✓ | label | Page identifier |
title | string | Page title override. Defaults to value from page resource. | |
layout | reference to layout | Layout override for this page. Defaults to chapter default. | |
reference | ✓ | reference to page | Reference to the page resource |
Default Values
Section titled “Default Values”The following defaults are applied automatically:
Settings Defaults
Section titled “Settings Defaults”settings { theme = "modern_dark"
timelimit { duration = "15m" extend = "0" show_timer = true }
idle { enabled = true timeout = "5m" show_warning = true }
controls { show_stop = true }}Validation Rules
Section titled “Validation Rules”- 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
Examples
Section titled “Examples”Minimal Lab
Section titled “Minimal Lab”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 } } }}Lab with Custom Settings
Section titled “Lab with Custom Settings”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 } } }}Layout Inheritance
Section titled “Layout Inheritance”Layouts are inherited in the following order (most specific wins):
- Page-level layout (highest priority)
- Chapter-level layout
- 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 } } }}Best Practices
Section titled “Best Practices”- Descriptive Titles: Use clear, descriptive titles for labs and chapters
- Appropriate Timeframes: Set realistic time limits based on lab complexity
- Tag Consistently: Use consistent tags across labs for better organization
- Layout Hierarchy: Use layout inheritance to minimize repetition
- Chapter Organization: Group related pages into logical chapters