Opening Runbooks
The runbooks open command opens a runbook in the browser. It accepts two kinds of sources:
- A runbook (a directory containing
runbook.mdx), or - An OpenTofu/Terraform module (a directory containing
.tffiles).
Either source can be local or remote.
See the open command reference for the full list of flags and supported URL formats.
Opening a Runbook
Section titled “Opening a Runbook”Point the CLI at a directory containing a runbook.mdx:
# Localrunbooks open ./runbooks/deploy-rds
# Remote (GitHub URL)runbooks open https://github.com/org/repo/tree/main/runbooks/deploy-rdsRunbooks serves the runbook.mdx in the browser. For remote sources, it downloads just the runbook directory via sparse git clone.
Opening an OpenTofu/Terraform Module
Section titled “Opening an OpenTofu/Terraform Module”Point the CLI at a directory containing .tf files:
# Localrunbooks open ./modules/rds
# Remote (GitHub URL)runbooks open https://github.com/org/repo/tree/main/modules/rds
# Remote (OpenTofu shorthand)runbooks open github.com/org/repo//modules/rds?ref=v1.0When Runbooks detects .tf files (and no runbook.mdx), it uses a tf-runbook template to auto-generate a runbook that:
- Parses the module’s variables from the
.tffiles - Renders a web form for those variables
- Generates output (e.g., a
terragrunt.hclfile) using the template
By default, the ::terragrunt built-in template is used. Use the --tf-runbook flag to select a different built-in template or custom template.
Built-in Templates
Section titled “Built-in Templates”runbooks open --tf-runbook=::terragrunt ./modules/rds| Template | What it generates | When to use |
|---|---|---|
::terragrunt (default) | terragrunt.hcl with non-default inputs | Standard Terragrunt workflows |
::terragrunt-github | terragrunt.hcl + GitHub PR | GitOps: clone a repo, pick a directory, generate config, open a PR |
::tofu | main.tf with a module block | Plain OpenTofu/Terraform (no Terragrunt) |
Custom Templates
Section titled “Custom Templates”If the built-in templates don’t fit your needs, create your own. A custom template is a local directory containing a runbook.mdx that uses <TfModule> with source="::cli_runbook_source".
my-custom-template/ runbook.mdxInside runbook.mdx, the ::cli_runbook_source keyword resolves to whatever module URL was passed on the command line:
# Configure Module
<TfModule id="module-vars" source="::cli_runbook_source" />
<TemplateInline inputsId="module-vars" outputPath="terragrunt.hcl" generateFile={true}>```hclterraform { source = "{{ ._module.source }}"}
inputs = {{{- range $name, $hcl := ._module.hcl_inputs }} {{ $name }} = {{ $hcl }}{{- end }}}```</TemplateInline>Run it with:
runbooks open --tf-runbook ./my-custom-template/ https://github.com/org/repo/tree/main/modules/rdsThis example uses <TemplateInline> for simplicity, but custom templates can use <Template> for multi-file scaffolding and extra variables. See <TfModule> — Template Patterns for details.
What ::cli_runbook_source Resolves To
Section titled “What ::cli_runbook_source Resolves To”The keyword resolves to the RUNBOOK_SOURCE argument you pass on the command line:
| Command | ::cli_runbook_source resolves to |
|---|---|
runbooks open --tf-runbook ./tpl/ ./modules/rds | Absolute path to ./modules/rds |
runbooks open --tf-runbook ./tpl/ https://github.com/org/repo/tree/main/modules/rds | https://github.com/org/repo/tree/main/modules/rds |
runbooks open --tf-runbook ./tpl/ github.com/org/repo//modules/rds?ref=v1.0 | github.com/org/repo//modules/rds?ref=v1.0 |
If the runbook is opened without a module URL (e.g., runbooks open --tf-runbook ./tpl/), <TfModule> renders a message explaining how to provide one.
Colocated Runbooks
Section titled “Colocated Runbooks”Module authors can ship a custom runbook alongside their .tf files by placing a runbook.mdx in the module directory:
modules/rds/ main.tf variables.tf outputs.tf runbook.mdx <-- custom runbookWhen someone runs runbooks open on this directory, the colocated runbook.mdx is served instead of generating one from a template. Inside, use source="." to reference the module in the same directory:
# Configure RDS
<TfModule id="rds-vars" source="." />
<TemplateInline inputsId="rds-vars" outputPath="terragrunt.hcl" generateFile={true}>```hclterraform { source = "{{ ._module.source }}"}
inputs = {{{- range $name, $hcl := ._module.hcl_inputs }} {{ $name }} = {{ $hcl }}{{- end }}}```</TemplateInline>This works with both local and remote modules:
# Localrunbooks open ./modules/rds
# Remote — still serves the colocated runbook.mdxrunbooks open https://github.com/org/repo/tree/main/modules/rds