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
| Field | Type | Required | Description |
|---|---|---|---|
title | string | ✓ | Lab title displayed to users |
description | string | ✓ | The description introduces your lab to learners. Explain what it covers, its purpose, and any prerequisites or outcomes. |
icon | string | — | Lab icon image, either an asset path within the assets/ directory or an external URL |
languages | list(string) | — | Localization languages supported by this lab (e.g., 'en', 'es', 'ja') |
settings | block | — | Lab behavior settings |
layout | referencelayout | ✓ | Default layout for the lab |
content | block | — | Lab content structure with chapters and pages |
Settings
Lab behavior settings
| Field | Type | Required | Description |
|---|---|---|---|
theme | string | — | Themes define the visual style of your lab interface. Choose one that best fits your content and brand. Allowed modern-dark original |
timelimit | block | — | Time limit configuration |
idle | block | — | Idle timeout configuration |
controls | block | — | UI control visibility |
Time Limit
Time limit configuration
| Field | Type | Required | Description |
|---|---|---|---|
duration | string | — | Set how long the lab can run before it automatically shuts down. |
extend | string | — | Allow learners to extend their lab session when they reach the time limit. |
show_ | bool | — | Show or hide the timer for learners during the lab. Default true |
Idle Timeout
Idle timeout configuration
| Field | Type | Required | Description |
|---|---|---|---|
enabled | bool | — | Define how long a lab can stay inactive before it stops automatically. Default true |
timeout | string | — | Idle time before shutdown (e.g., '30m') |
show_ | bool | — | Show warning before timeout Default true |
Controls
UI control visibility
| Field | Type | Required | Description |
|---|---|---|---|
show_ | bool | — | Control whether the stop button is visible to learners. Turning it off prevents users from stopping the lab manually. Default true |
Content
Lab content structure with chapters and pages
| Field | Type | Required | Description |
|---|---|---|---|
title | string | — | Content section title |
chapter | block | — | Content chaptersrepeatable |
Chapter
Content chapters
| Field | Type | Required | Description |
|---|---|---|---|
slug | label | — | Chapter slug identifier |
title | string | ✓ | Chapter title |
layout | referencelayout | — | Chapter-specific layout override |
page | block | — | Pages within this chapterrepeatable |
Page
Pages within this chapter
| Field | Type | Required | Description |
|---|---|---|---|
slug | label | — | Page slug identifier |
title | string | — | Page title override |
layout | referencelayout | — | Page-specific layout override |
reference | referencepage | ✓ | Reference to the page resource |
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
