Lab

Lab

The lab resource provides the metadata about the lab and some of its configuration. This is the equivalent of what is currently called a "track".


resource "lab" "name" {
 ...
}

Attributes

Attribute
Description

Title title required type: string

The title of the lab.

title = "My Lab"

Description description required type: string

A description of the lab.

description = <<-EOF
The description of my lab.
EOF
description = file("instructions/description.md")

Tags tags type: []string

Tags that describe the lab.

tags = ["something", "else"]

Settings settings type: block Settings

Settings that configure the lab.

settings {
  timeout {
    ...
  }

  idle {
    ...
  }

  controls {
    ...
  }
}

Layouts layout type: []block Layout

A layout that can be used within the lab. This block can be specified multiple times on a lab resource, to allow using multiple layouts throughout a lab.

layout "single_panel" {
  reference = resource.layout.single
}

Content content type: block Content

The instructional content of the lab that is presented to the end-user.

content {
  chapter "first_chapter" {
    ...
  }
}

Computed Attributes

These attributes are computed when the config is parsed and applied, and are therefore only known at parsetime or runtime.

Attribute
Description

Meta ID meta.id string

The full ID of the resource e.g. `resource.type.name`. This is computed from the full resource path:

// given the following resource
resource "container" "ubuntu" {
  ...
}

// the resulting id will be
resource.container.ubuntu

Meta Type meta.type string

The type of the resource. This taken from the type label of the resource definition.

// given the following resource
resource "container" "ubuntu" {
  ...
}

// the resulting type will be
container

Meta Name meta.name string

The name of the resource. This taken from the name label of the resource definition.

// given the following resource
resource "container" "ubuntu" {
  ...
}

// the resulting name will be
ubuntu

DefaultLayout default_layout type: string

The default layout is determined by the first layout that has the `default` field set to `true`. In the case that no layout has a default set, the first layout defined on the lab will be set as the default.

default_layout = "single_panel"


Settings

Settings that configure the lab.


resource "lab" "name" {
  settings {
    ...
  }
}

Attributes

Attribute
Description

Theme theme type: string default: modern_dark

The theme used to style the lab.

theme = "original"

TimeLimit timelimit type: block TimeLimit

Configure the timelimit settings.

timelimit {
  duration = 30
}

Idle idle type: block Idle

Configure the idle timeout settings.

idle {
  enabled = false
}

Controls controls type: block Controls

Configure the controls that are presented to the end-user.

controls {
  show_stop = true
}

Computed Attributes

These attributes are computed when the config is parsed and applied, and are therefore only known at parsetime or runtime.


TimeLimit

Configure the timelimit settings.


resource "lab" "name" {
  settings {
    timelimit {
      ...
    }
  }
}

Attributes

Attribute
Description

Duration duration type: int default: 15

The maximum duration of the lab in minutes.

duration = 15

Extend extend type: int default: 0

How long the lab can be extended in minutes once the timelimit is hit. Set to 0 to disable extending.

extend = 5

ShowTimer show_timer type: bool default: true

Whether or not to show the timelimit timer to the end-user.

show_timer = true

Computed Attributes

These attributes are computed when the config is parsed and applied, and are therefore only known at parsetime or runtime.


Idle

Configure the idle timeout settings.


resource "lab" "name" {
  settings {
    idle {
      ...
    }
  }
}

Attributes

Attribute
Description

Enabled enabled type: bool default: true

Whether or not idle timeout is enabled.

enabled = true

Timeout timeout type: int default: 5

The inactivity duration in minutes after which an end user will be timed out.

timeout = 5

ShowWarning show_warning type: bool default: true

Whether or not to show an idle timeout warning to the end user.

show_warning = true

Computed Attributes

These attributes are computed when the config is parsed and applied, and are therefore only known at parsetime or runtime.


Controls

Configure the controls that are presented to the end-user.


resource "lab" "name" {
  settings {
    controls {
      ...
    }
  }
}

Attributes

Attribute
Description

ShowStop show_stop type: bool default: true

Whether or not to show the stop lab button to the end-user.

show_stop = true

Computed Attributes

These attributes are computed when the config is parsed and applied, and are therefore only known at parsetime or runtime.


Layout

A layout that can be used within the lab. Layouts define what panels and tabs are visible and how they are arranged.


resource "lab" "name" {
  layout "name" {
    ...
  }
}

Attributes

Attribute
Description

Name name required type: string

The name of the layout, that can be used by chapters and pages to switch to.

Reference reference required type: Reference to Layout

A reference to the layout that defines the panels.

reference = resource.layout.two_panels

Default default type: bool

Whether or not the layout of the default one to use when the lab does not have any instructional content.

default = true

Tabs tab type: []block Tab

The tabs that are used within the layout.

tab "terminal" {
  panel = "left_panel"
  target = resource.terminal.ubuntu
}

Instructions instructions type: block Instructions

The instructional content that is displayed in the layout.

instructions {
  panel = "right_panel"
}

Computed Attributes

These attributes are computed when the config is parsed and applied, and are therefore only known at parsetime or runtime.


Tab

A tab that is used within the layout and points at a tab target e.g. Terminal, Service, Editor, etc.


resource "lab" "name" {
  layout "name" {
    tab "name" {
      ...
    }
  }
}

Attributes

Attribute
Description

Name name required type: string

The Name of the tab.

tab "name" {
  ...
}

Panel panel required type: string

The name of the panel of the layout that the tab is displayed in.

panel = "left_panel"

Target target required type: Reference to Terminal, Service, Editor, ExternalWebsite, Note

The target resource of the tab that is shown when the tab is active.

target = resource.terminal.ubuntu

Title title type: string

The title of the tab.

title = "Ubuntu"

Active active type: bool

Whether or not the tab is active.

active = true

Visible visible type: bool

Whether or not the tab is visible.

visible = true

Closeable closeable type: bool

Whether or not the tab is closeable.

closeable = true

Movable movable type: bool

Whether or not the tab is movable.

movable = true

Computed Attributes

These attributes are computed when the config is parsed and applied, and are therefore only known at parsetime or runtime.


Instructions

The instructional content that is displayed in the layout.


resource "lab" "name" {
  layout "name" {
    instructions {
      ...
    }
  }
}

Attributes

Attribute
Description

Panel panel required type: string

The panel of the layout that the instructions are displayed in.

panel = "left_panel"

Title title type: string

The title of the instructions tab.

title = "Assignment"

Active active type: bool

Whether or not the tab is active.

active = true

Visible visible type: bool

Whether or not the tab is visible.

visible = true

Closeable closeable type: bool

Whether or not the tab is closeable.

closeable = true

Movable movable type: bool

Whether or not the tab is movable.

movable = true

Computed Attributes

These attributes are computed when the config is parsed and applied, and are therefore only known at parsetime or runtime.


Content

The instructional content of the lab that is presented to the end-user.


resource "lab" "main" {
  content {
    ...
  }
}

Attributes

Attribute
Description

Title title type: string

The title of the content tab.

title = "Instructions"

Chapters chapter type: []block Chapter

The chapters that are part of the content.

chapter "first_chapter" {
  page "first_page" {
    reference = resource.page.first
  }
}

Computed Attributes

These attributes are computed when the config is parsed and applied, and are therefore only known at parsetime or runtime.


Chapter

A chapter within the content.


resource "lab" "name" {
  content {
    chapter "name" {
      ...
    }
  }
}

Attributes

Attribute
Description

Slug slug required type: string

The slug of the chapter.

chapter "slug" {
  ...
}

Title title required type: string

The title of the chapter.

title = "Introduction"

LayoutName layout_name type: string

The default layout for all pages in the chapter.

layout_name = "single_panel"

Pages page type: []block Page

The pages that are part of the chapter.

page "getting_started" {
  reference = resource.page.getting_started
}

Computed Attributes

These attributes are computed when the config is parsed and applied, and are therefore only known at parsetime or runtime.


Page

A page within a chapter that is part of the content.


resource "lab" "name" {
  content {
    chapter "name" {
      page "name" {
        ...
      }
    }
  }
}

Attributes

Attribute
Description

Slug slug required type: string

The slug of the page.

page "slug" {
  ...
}

Reference reference required type: Reference to Page

A reference to the resource of the page that contains the content.

reference = resource.page.getting_started

Title title type: string

The title of the page. This overrides the title of the page source.

title = "Getting Started"

LayoutName layout_name type: string

The layout to use for the page. When switching to that page, the layout will then change to the selected layout.

layout_name = "single_panel"

Computed Attributes

These attributes are computed when the config is parsed and applied, and are therefore only known at parsetime or runtime.

Examples

Full Example

resource "lab" "minimal" {
  title = "Minimal"
  description = "This is a minimal example lab."

  settings {
    idle {
      enabled = false
    }
  }

  layout "minimal" {
    default = true
    reference = resource.layout.minimal

    tab "terminal" {
      panel = "terminal"
      target = resource.terminal.shell
    }

    instructions {
      panel = "instructions"
    }
  }

  layout "instructions_only" {
    reference = resource.layout.minimal

    instructions {
      panel = "instructions"
    }
  }

  content {
    chapter "introduction" {
      title = "Introduction"
      layout_name = "minimal"
      
      page "first" {
        layout_name = "instructions_only"
        reference = resource.page.first
      }

      page "second" {
        reference = resource.page.second
      }
    }

    chapter "imported" {
      title = "Imported"

      page "first" {
        reference = module.chapter.output.pages.first
      }

      page "second" {
        reference = module.chapter.output.pages.second
      }
    }
  }
}

Last updated