Skip to content

Generated Files

When you use a Runbook, files are generated locally on your machine. This page explains how file generation works and where those files end up.

Files can be generated in two ways:

The Template and TemplateInline blocks generate files from Boilerplate templates. When you fill in the form fields and click “Generate”, the template engine processes your inputs and creates the output files.

<Template id="vpc-setup" path="templates/vpc" />

Template blocks automatically re-render when you change input values, so your generated files stay in sync with the form.

Command blocks can write files to the $RUNBOOKS_OUTPUT environment variable to capture them:

<Command
id="export-terraform"
command={`tofu output -json > "$RUNBOOKS_OUTPUT/tf-outputs.json"`}
title="Export Terraform outputs"
/>

Any files written to $RUNBOOKS_OUTPUT automatically appear in your generated files after the command completes successfully.

Generated files are persisted to a folder on your local machine—they’re not ephemeral or stored in memory.

By default, generated files are written to a generated/ folder in the current working directory (the directory you run the runbooks command from):

  • Directorygenerated/ ← Created in your current working directory
    • main.tf
    • variables.tf
    • outputs.tf

You can change where generated files are written using the --output-path flag:

Terminal window
# Write to a custom folder
runbooks open my-runbook --output-path ./infrastructure
# Nested subdirectory
runbooks open my-runbook --output-path ./projects/acme/infra

Relative paths are resolved from the current working directory.

Within a runbook, you can organize generated files into subdirectories:

  • Template blocks: The directory structure of your template folder is preserved in the output.
  • TemplateInline blocks: Use the outputPath prop to specify a path like config/app.yaml.
  • Command/Check blocks: Create subdirectories within $RUNBOOKS_OUTPUT.
Terminal window
# In your command script
mkdir -p "$RUNBOOKS_OUTPUT/config"
echo '{}' > "$RUNBOOKS_OUTPUT/config/app.json"

When files are generated, they appear in the file panel on the right side of the Runbooks UI. You can:

  • Browse the file tree
  • Click files to view their contents
  • Copy file contents to clipboard
  • See which files changed after each render

Runbooks enforces strict rules about where files can be written to protect your system:

RuleDescription
Within working directoryAll paths must resolve to locations within your current working directory
No directory traversalPaths containing .. (like ../../../etc/passwd) are rejected
No system directoriesProtected directories like /etc, /usr, C:\Windows are blocked

Runbooks blocks writes to system-critical directories:

  • /, /etc, /usr, /bin, /var, /home, /root
  • C:\, C:\Windows, C:\Program Files, C:\Users

Now that you understand how generated files work, explore the use cases where Runbooks shines.