Skip to content
Author with AI

<Command>

The <Command> block runs a shell command or script, with user input substituted in. Use it for deployments, resource creation, and anything else that changes state.

<Command
id="trigger-deploy"
command="curl -X POST https://api.example.com/deploy"
title="Trigger Deployment"
successMessage="Deployment triggered!"
failMessage="Failed to trigger deployment"
/>

Command and Check blocks share most of their features. A Check reads the state of the world and validates it. A Command changes it.

  • id (string): unique identifier for this command block
  • title (string): display title shown in the UI. Supports inline markdown (bold, italic, links, code).
  • description (string): longer description of what the command does. Supports inline markdown.
  • autoCollapse (boolean): whether the block folds down to its title once it’s done. Defaults to false. Click it to show the block in full again. See Folding done blocks.
  • command (string): inline command to execute. Set exactly one of command and path. If both are set, command runs.
  • path (string): path to a script file, relative to the runbook’s folder, such as scripts/deploy.sh. The file must be inside that folder, so a path with a .. segment fails. Use either this or command.
  • inputsId (string | string[]): ID of an Inputs block to get template variables from. Can be a single ID or an array of IDs. When multiple IDs are provided, variables are merged in order, and later IDs override earlier ones. A block that uses {{ .inputs.* }}, in env or in the script, needs this prop or a nested Inputs block. See With variables.
  • env (object): environment variables the script runs with, by name, such as env={{ BUCKET: "{{ .inputs.BucketName }}" }}. Each value can reference inputs and block outputs. See Passing values as environment variables.
  • awsAuthId (string): ID of an AwsAuth block for AWS credentials. The credentials are passed as environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN, AWS_REGION). The Run button is disabled until authentication completes.
  • gitAuthId (string): ID of a GitAuth, GitHubAuth or GitLabAuth block, for either provider. Its credentials are passed as environment variables (GITHUB_TOKEN and GITHUB_USER, or GITLAB_TOKEN and GITLAB_USER). The Run button is disabled until authentication completes.
  • githubAuthId (string): ID of a GitHubAuth block. GitHub only. The credentials are passed as environment variables (GITHUB_TOKEN, GITHUB_USER). The Run button is disabled until authentication completes. Prefer gitAuthId. With both set, the block waits for both and passes the variables of both, the gitAuthId block’s where they overlap.
  • googleAuthId (string): ID of a GoogleAuth block for Google Cloud credentials. The block’s credentials are passed as environment variables (GOOGLE_APPLICATION_CREDENTIALS, CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE, GOOGLE_CLOUD_PROJECT, CLOUDSDK_CORE_PROJECT, GOOGLE_PROJECT, CLOUDSDK_CORE_ACCOUNT, and the region/zone variables), overriding the session environment for this execution only. The Run button is disabled until authentication completes.
  • azureAuthId (string): ID of an AzureAuth block for Azure credentials. The block’s AZURE_CONFIG_DIR, tenant and subscription variables, ARM_USE_CLI, and a service principal’s client variables are passed as environment variables, overriding the session environment for this execution only. The Run button is disabled until the block has signed in.
  • azureTenants (string[]): The tenant roles of the azureAuthId block this script needs, e.g. azureTenants={["landing zone", "billing"]}. The Run button is disabled until each is ready, and they’re checked again just before it runs. The script gets each role’s tenant ID as AZURE_TENANT_<ROLE>.
  • successMessage (string): message shown when the command succeeds. Default “Success”. Supports inline markdown.
  • failMessage (string): message shown when the command fails. Default “Failed”. Supports inline markdown.
  • runningMessage (string): message shown while running. Default “Running…”. Supports inline markdown.
  • timeoutMs (number): maximum time, in milliseconds, the script may run before it is killed and the block is marked as failed. Defaults to 3600000 (60 minutes). Raise it for scripts that run longer, for example timeoutMs={7200000} for a 2-hour deployment, or lower it so a hung script fails sooner. Runbook tests ignore it and apply the test’s timeout setting instead.
  • dependsOn (string | string[]): ID of a Command, Check or Prerequisites block, or an array of IDs, that must succeed before this block can run. A Check or Prerequisites block that ends with a warning counts too. See Run order.
  • exclusive (boolean): whether this block runs alone. Defaults to false. While it runs, no other Command or Check block can start, and it can’t start while another one is running. See Run order.
  • showWhenBlock ({ id: string, status: string | string[] }): show this block only while the latest run of another Command, Check, Finish or Prerequisites block ended with status: success, warn or fail, or a list of them. See Showing a block after another one fails.

You can nest an <Inputs> component directly inside the Command:

<Command
id="echo-message"
env={{ NAME: "{{ .inputs.Name }}" }}
command='echo "Hello, $NAME!"'
title="Print Greeting"
>
<Inputs id="inline-greeting">
```yaml
variables:
- name: Name
type: string
description: Your name
validations:
- required
```
</Inputs>
</Command>

The embedded <Inputs> renders inside the Command block, so users fill in variables before running the command. Other blocks can reference it by inputsId like any standalone Inputs block.

Scripts can be defined inline with the command prop or stored in external files referenced by the path prop.

For simple commands, define the script directly in the command prop:

<Command
id="deploy-trigger"
command="curl -X POST https://api.example.com/deploy"
title="Trigger Deployment"
successMessage="Deployment triggered!"
failMessage="Failed to trigger deployment"
/>

Inline scripts suit one-liners. For anything longer, use an external script file.

A command that contains both kinds of quotes, or spans several lines, can go in a template literal: command={`echo "It's done"`}. Two things work differently there:

  • ${...} is a JavaScript substitution, which Runbooks rejects when the runbook opens. Write $VAR or \${VAR}, not ${VAR}.
  • JavaScript reads backslash escapes, as in any JavaScript string: \n is a line break, \` a backtick, and so on. Write \\ for each backslash the shell should see, such as grep '\\.tf$'.
<Command
id="deploy-app"
path="scripts/deploy.sh"
title="Deploy Application"
description="This will deploy your application to production"
successMessage="Deployment successful!"
failMessage="Deployment failed. Check the logs for details."
/>

External scripts are plain bash scripts. The referenced scripts/deploy.sh might look like:

#!/bin/bash
log_info "Starting deployment..."
kubectl apply -f "$REPO_FILES/k8s/deployment.yaml"
if kubectl rollout status deployment/myapp; then
log_info "Deployment complete!"
exit 0
else
log_error "Deployment failed"
exit 1
fi

Scripts start in the session’s directory, not in the runbook’s folder, so this one reads its manifest from the repository a <GitClone> block cloned. See Execution context.

If you edit the script file while the runbook is open, the block shows a “Script changed” notice with the diff and keeps running the version it loaded. Click Reload script in the notice to run the new version. See Reloading a changed script file.

Exit code 0 renders as success (green). Any other exit code renders as failure (red).

Exit code 2 is a warning for Check blocks. A Command that exits 2 is shown as failed, but Runbooks still treats the run as a warning internally. Files written to $GENERATED_FILES are captured, and the script’s environment changes carry forward. Blocks whose dependsOn names it keep waiting, as they would after a failure.

Runbooks sources a logging.sh file into every bash script, which defines a set of logging functions. Using them lets the Runbooks UI parse log levels for filtering and export.

Function Output Description
log_info "msg" [timestamp] [INFO] msg General informational messages
log_warn "msg" [timestamp] [WARN] msg Warning conditions
log_error "msg" [timestamp] [ERROR] msg Error messages
log_debug "msg" [timestamp] [DEBUG] msg Debug output (only when DEBUG=true)

The logging functions append to a log file that Runbooks creates for each run, and Runbooks shows those lines in the block’s logs as your script writes them, in the order it wrote them. They never write to stdout, so you can call them inside a function whose output you capture with $(...). The captured value holds only what the function prints.

Terminal window
get_account_id() {
log_info "Looking up the AWS account ID..."
aws sts get-caller-identity --query Account --output text
}
ACCOUNT_ID=$(get_account_id)
#!/bin/bash
log_info "Starting deployment..."
log_debug "Target environment: $ENVIRONMENT"
if [ -z "$API_KEY" ]; then
log_warn "API_KEY not set, some features may be unavailable"
fi
if ! deploy_application; then
log_error "Deployment failed"
exit 1
fi
log_info "Deployment complete"

Each run gets a set of log files. Runbooks puts their paths in environment variables, the way $RUNBOOK_OUTPUT holds the path of the outputs file:

Variable Written by Level in the logs
RUNBOOK_LOG log_info, log_warn, log_error, log_debug The level each line names
RUNBOOK_INFO_LOG Your commands INFO
RUNBOOK_WARN_LOG Your commands WARN
RUNBOOK_ERROR_LOG Your commands ERROR
RUNBOOK_DEBUG_LOG Your commands DEBUG

All four logging functions append to $RUNBOOK_LOG, so their lines keep the order your script wrote them in, whatever their level. Runbooks shows the lines in $RUNBOOK_LOG as they are written, so a line you add there yourself should name its level the same way, for example [WARN] Quota is almost used up.

The per-level files are for output that doesn’t name a level, such as a tool’s stderr. Any command can append to them directly. Runbooks adds a timestamp and the file’s level to each line that doesn’t already start with them, so the line shows up at that level:

Terminal window
# tofu's errors appear as [ERROR] lines; its JSON output stays in the variable
PLAN_JSON=$(tofu show -json plan.tfplan 2>>"$RUNBOOK_ERROR_LOG")

Append with >>. Overwriting a log file with > can drop or repeat lines.

Scripts in other languages get the same variables. For example, in Python:

import os
with open(os.environ["RUNBOOK_WARN_LOG"], "a") as log:
print("Quota is almost used up", file=log)

Runbooks reads the log files while your script runs, so their lines appear next to its stdout and stderr, normally in the order the script wrote them. Lines written to different log files close together can appear grouped by file, with the lines from $RUNBOOK_LOG first. log_debug only writes when DEBUG=true, but every line in $RUNBOOK_DEBUG_LOG is shown, whoever wrote it.

The files are deleted when the run ends, so lines that a background job writes after the script exits don’t appear. From then on, the logging functions write to stderr instead, so the job’s later log lines go wherever you redirected its output. Don’t redirect a background job’s output to the log files: once they are deleted, a command whose output is redirected to one of them fails without running.

Outside the Runbooks UI, the logging functions aren’t injected. To simulate the Runbooks environment, run this one-liner in your terminal session (bash or zsh):

Terminal window
mkdir -p ~/.config/runbooks && curl -fsSL https://raw.githubusercontent.com/gruntwork-io/runbooks/main/scripts/logging.sh -o ~/.config/runbooks/logging.sh && export BASH_ENV=~/.config/runbooks/logging.sh

This sets BASH_ENV, which tells bash to source the logging functions before running any script. It works from bash and zsh parent shells and lasts until the terminal is closed. The same script then works in both environments.

Outside Runbooks RUNBOOK_LOG isn’t set, so the logging functions write to stderr instead. The one-liner overwrites ~/.config/runbooks/logging.sh, so re-run it to pick up changes to the logging functions. Copies downloaded before the log files existed write to stdout, where the log lines end up in $(...) captures.

A script gets the values it needs as environment variables, which the env prop sets from inputs and block outputs. The examples below take inputs from different places.

The command or script pulls its values from a separate Inputs block.

<Inputs id="repo-config">
```yaml
variables:
- name: OrgName
type: string
description: GitHub organization name
- name: RepoName
type: string
description: Repository name
```
</Inputs>
<Command
id="create-repo"
inputsId="repo-config"
env={{ ORG: "{{ .inputs.OrgName }}", REPO: "{{ .inputs.RepoName }}" }}
command='gh repo create "$ORG/$REPO" --private'
title="Create GitHub Repository"
successMessage="Repository {{ .inputs.RepoName }} created!"
failMessage="Failed to create repository"
/>

The message props can reference inputs and outputs directly, since Runbooks only shows them.

The Command collects input values directly. Other blocks can read them like any standalone Inputs block.

<Command
id="echo-message"
env={{ NAME: "{{ .inputs.Name }}" }}
command='echo "Hello, $NAME!"'
title="Print Greeting"
>
<Inputs id="inline-greeting">
```yaml
variables:
- name: Name
type: string
description: Your name
validations:
- required
```
</Inputs>
</Command>

Pass an array of IDs to reference several Inputs blocks. Variables are merged in order, and later IDs override earlier ones:

<Inputs id="lambda-config" templatePath="templates/lambda" />
<Inputs id="repo-config">
```yaml
variables:
- name: GithubOrgName
type: string
description: GitHub organization name
- name: GithubRepoName
type: string
description: Repository name
```
</Inputs>
<Command
id="deploy-lambda"
path="scripts/deploy.sh"
inputsId={["lambda-config", "repo-config"]}
env={{ ORG: "{{ .inputs.GithubOrgName }}", REPO: "{{ .inputs.GithubRepoName }}" }}
title="Deploy Lambda Function"
description="Deploy the Lambda function using variables from both inputs"
/>

If both blocks define a variable with the same name, the value from repo-config wins.

The env prop sets environment variables for the script, by name. Each value is a template, rendered with the block’s inputs and the outputs of other blocks, and the script reads the result like any other environment variable:

<Command
id="label-pr"
inputsId="pr-config"
env={{
REPO: "{{ .inputs.RepoName }}",
PR_TITLE: "{{ .outputs.fetch_pr.title }}",
DRY_RUN: false,
}}
command='gh pr edit --repo "$REPO" --title "[infra] $PR_TITLE"'
/>

Runbooks gives the script the values as data. The shell never runs anything in them, so a value can hold quotes, $(...) or backticks, as a PR title or an API response can. Quote each variable where you use it, as above, so a value with spaces stays in one piece.

  • The block shows the values. Before you click Run, the block lists each variable with the value the script will get, once the inputs and outputs it references are set. The block waits for them, as it waits for the values its script references. A sensitive output shows as <redacted>, and the script gets its real value.
  • You can enter an output’s value yourself. See Entering an output by hand.
  • Instruction mode exports them. In instruction mode, the block shows an export line for each variable before the command, quoted for the shell, so you can copy and run them together.
  • They are this block’s. The variables are set for this run only, and later blocks don’t see them. If the script changes one, the new value carries forward like any other export. To pass a value to later blocks, write it as a block output.
  • They override other variables. A variable in env replaces one of the same name from the session or from an auth block, so env={{ AWS_REGION: "{{ .inputs.Region }}" }} picks the region for a block that uses awsAuthId.

A name has letters, digits and underscores, and doesn’t start with a digit. A value is a string, a number or a boolean. Runbooks sets GENERATED_FILES, REPO_FILES and every name that starts with RUNBOOK_ itself, so env can’t use them. A block whose env breaks these rules shows the error and can’t run.

In the block’s list of variables, each output a value reads is a chip. It shows the value the script will get, or, before the block that produces it has run, which output it is. Click the chip and it turns into a field, in its place, where you can type another value. Press Enter, or click away after changing it, to use it. Press Escape to get the chip back. The block then uses that value in place of the output, in its env and in its script, and doesn’t wait for the block that produces it. Use this to run the block when that block can’t run on your machine, or to try another value.

  • Reset goes back to the output. A value you entered stays in its field, where you can change it, with a reset button next to it that brings the chip back.
  • The value is this block’s. Other blocks that read the same output still get the output.
  • A secret stays a secret. A value you enter for a sensitive output is sensitive too. The field hides what you type, and starts empty rather than showing the output or the value you entered before.
  • The session keeps it. A resumed session brings back the values you entered.
  • dependsOn still applies. A block that names the producing block in dependsOn waits for it to run anyway.

Chips appear for values made of text and plain references, such as "{{ .outputs.fetch_pr.title }}" or "s3://{{ .outputs.create_bucket.name }}/logs". A value with other template code, such as an input, a pipe or a condition, shows the value the script will get, without chips.

A script can also reference values directly, as {{ .inputs.Name }} or {{ .outputs.build.tag }}. Runbooks inserts them into the script’s source before it runs, verbatim, with no quoting or escaping. Quote a reference where the shell needs it, for example REGION="{{ .inputs.AwsRegion }}", and compare strings directly, for example {{ if eq .inputs.Language "JavaScript" }}.

A block whose script references inputs or outputs shows a note above the script that names them, and runbook tests print a warning for it. The script still runs.

If the script can’t be rendered, for example because it calls an unknown function or contains a {{ }} expression meant for another tool, the block fails with the template error and the script does not run. To pass {{ }} through to a tool such as docker ps --format, write it as a raw string: --format '{{`{{.Names}}`}}'.

Scripts run in a persistent environment. Environment variable changes (export, unset) and working directory changes (cd) made by a script that exits 0 or 2 carry forward to later blocks, so earlier steps can set up the environment for later ones.

Scripts run in a non-interactive shell, so shell aliases such as ll and shell functions such as nvm or rvm are not available.

Scripts start in the session’s directory, not in the runbook’s folder. A cd carries forward as described above, so later scripts start wherever it left off. No environment variable names the runbook’s folder, so a script can’t call another script or read a file that ships with the runbook. Give each script file its own block with path. To work with a cloned repository’s files, use $REPO_FILES or the <GitClone> block’s clone_path output.

Scripts run without a terminal, and their standard input is empty. A command that asks for input, such as read, a confirmation prompt, or a sudo password prompt, gets none and usually fails. Use non-interactive flags, such as tofu apply -auto-approve or apt-get install -y. Tools that check for a terminal may also turn off colors and progress bars.

See Shell execution context for the details.

Command and Check blocks can run at the same time. A block’s Run button is disabled while the block has to wait for another one:

  • It uses another block’s outputs. A block that references {{ .outputs.build.tag }} can’t run until build has produced that output, and can’t run while build is running again.
  • It names another block in dependsOn. Use this when a script needs something an earlier script did that isn’t an output, such as a variable it exported, a directory it changed into, or a resource it created. The block can’t run until every block it names has succeeded, or for a Check, ended with a warning. A Command that exits 2 doesn’t count. If one of them later fails or is stopped, the block waits again.
  • It would overlap with an exclusive block. No other Command or Check block can start while an exclusive block runs, and an exclusive block can’t start while another one is running. Use this for a script that can’t share its resources, such as one that takes a state lock.
<Command id="login" command="export API_TOKEN=$(vault read -field=token secret/api)" />
<Command id="deploy" dependsOn="login" path="scripts/deploy.sh" />
<Command id="migrate" dependsOn={["login", "deploy"]} exclusive path="scripts/migrate.sh" />

A block that is waiting names the blocks it is waiting for. Click a name to scroll to that block. For a block that is running, there is also a button to stop it.

Each ID in dependsOn must name a Command, Check or Prerequisites block in the runbook. Runbooks doesn’t report an ID that names another kind of block, or no block at all. The block just keeps waiting for it.

showWhenBlock shows a Command, Check or Finish block only while the latest run of another block ended a certain way. Use it for a step that only applies after a failure, such as a button that re-runs a failed CI job right under the check that waits for it:

<Check id="check-plan" title="Wait for the plan" path="scripts/check-plan.sh" />
<Command
id="rerun-plan"
title="Re-run the plan"
showWhenBlock={{ id: "check-plan", status: "fail" }}
path="scripts/rerun-plan.sh"
/>

id names a Command, Check, Finish or Prerequisites block. status is success, warn or fail, or a list of them, such as status: ["warn", "fail"]. A Command that exits 2 counts as warn here, as it does for dependsOn.

  • Until the named block has run, and while it is running, the block is hidden. A hidden block isn’t counted in the runbook’s progress.
  • The block follows the named block’s latest run. In the example, running check-plan again and passing hides rerun-plan again.
  • A block that is running stays in view until it finishes, whatever the named block does.
  • A resumed session brings back each block’s last run, so the block shows or hides as it did before.
  • In instruction mode, nothing runs, so the block is always shown, and states when it applies, such as “Only when “check-plan” fails.”

Runbooks reports a configuration error when showWhenBlock names the block itself, or an ID that no Command, Check, Finish or Prerequisites block has. In runbook tests, a hidden block doesn’t run and is reported as hidden.

A block finishes once its script has exited and no process it started still has the script’s output open. To leave a process running for later blocks, such as a port-forward or a local dev server, start it in the background with its output redirected:

Terminal window
nohup kubectl port-forward svc/web 8080:80 > /tmp/port-forward.log 2>&1 &

Without the redirect, the block keeps waiting on the background process until timeoutMs kills it. Stopping a running block, or letting it hit timeoutMs, terminates the script together with every process it started. Quitting Runbooks while a block is running sends them the same termination signal.

scripts/deploy.sh
#!/bin/bash
set -e # Exit on error
log_info "Starting deployment..."
kubectl apply -f "$REPO_FILES/k8s/deployment.yaml"
kubectl rollout status deployment/myapp
log_info "Deployment complete!"
<Command
id="create-vpc"
path="scripts/create-vpc.sh"
inputsId="vpc-config"
env={{
REGION: "{{ .inputs.AwsRegion }}",
VPC_NAME: "{{ .inputs.VpcName }}",
CIDR_BLOCK: "{{ .inputs.CidrBlock }}",
}}
/>
scripts/create-vpc.sh
#!/bin/bash
log_info "Creating VPC $VPC_NAME in $REGION..."
log_debug "CIDR block: $CIDR_BLOCK"
aws ec2 create-vpc \
--cidr-block "$CIDR_BLOCK" \
--tag-specifications "ResourceType=vpc,Tags=[{Key=Name,Value=$VPC_NAME}]" \
--region "$REGION"
log_info "VPC created successfully!"
scripts/safe-deploy.sh
#!/bin/bash
set -e
function cleanup {
log_info "Cleaning up..."
# Cleanup code here
}
trap cleanup EXIT
log_info "Running pre-deployment checks..."
kubectl cluster-info > /dev/null || { log_error "Pre-checks failed"; exit 1; }
log_info "Deploying..."
kubectl apply -f "$REPO_FILES/k8s/"
log_info "Running post-deployment validation..."
kubectl rollout status deployment/myapp --timeout=5m || { log_error "Validation failed"; exit 1; }
log_info "Deployment successful!"

Scripts can write files to two destinations:

See the Files workspace page for more.

Files written to $GENERATED_FILES appear in the file panel after the script exits 0 or 2.

#!/bin/bash
# Export OpenTofu outputs to generated files
tofu output -json > "$GENERATED_FILES/tf-outputs.json"
# Copy a file from the cloned repository
cp "$REPO_FILES/config.yaml" "$GENERATED_FILES/"

Or as an inline command:

<Command
id="create-file"
title="Create a greeting file"
command={`echo "Hello from the command!" > "$GENERATED_FILES/greeting.txt"`}
successMessage="File created successfully!"
/>
#!/bin/bash
mkdir -p "$GENERATED_FILES/opentofu"
mkdir -p "$GENERATED_FILES/config"
tofu output -json > "$GENERATED_FILES/opentofu/outputs.json"
echo '{"env": "production"}' > "$GENERATED_FILES/config/settings.json"

This creates:

  • Directorygenerated/
    • Directoryopentofu/
      • outputs.json
    • Directoryconfig/
      • settings.json
  1. Before your script runs, Runbooks creates a temporary capture directory
  2. The $GENERATED_FILES environment variable points to this directory
  3. Your script writes files to $GENERATED_FILES
  4. If the script exits 0 or 2, the files are copied to the generated files directory
  5. The temporary directory is removed

Once a <GitClone> block has registered a repository, the $REPO_FILES environment variable points to its local path. With several repositories, it points to the one selected in the workspace’s repository dropdown: the first one added, whether by a clone or a local checkout, until the user selects another. Scripts can modify files inside the repository directly:

#!/bin/bash
# Modify a file in the cloned repository
echo "new setting = true" >> "$REPO_FILES/config.hcl"

Writes to $REPO_FILES are not captured to a temporary directory. They happen directly on the filesystem, and the Changed files tab shows them via git diff.

When a script plans infrastructure changes with Terragrunt or OpenTofu, it can have the block show what the plan will change. Write each plan as JSON to the directory in $RUNBOOK_PLAN_DIR, and the block shows a View Plan panel above its logs:

  • The whole run’s changes in its header, as a bar: creates are an outline, updates solid amber, replaces hatched and destroys solid red, and each is a short line where there are none. Imports (a blue outline), moves (solid blue) and forgets (hatched amber) join the bar where the plan has them. Hover a part to see its count, such as 2 to destroy in 2 units. A replace counts once here, where OpenTofu’s own log counts it as one add and one destroy.
  • A row for each unit with its result and a bar of what it changes, on one scale for the whole stack. Hover or focus a part of the bar to see its count, and click it to open the unit on that action. Units that change nothing, not even an output, fold into one line. A unit that failed, stopped early or was excluded says why, and so does one whose plan failed where an ignore block in its errors let the run go on: it shows as failed, naming the block.
  • Click a unit to open it under its row. Its header counts what it changes by action, destroys first, then the outputs it changes, and each count is a tab. A tab lists its resources, with one that’s imported or moved as well as changed under both tabs, with many instances of one resource (role_assignment × 24) folded into one entry, or its outputs, signed as OpenTofu signs them. Pick a resource to see its change in OpenTofu’s plan notation, with # forces replacement on what forces a replace and why a resource is destroyed.
  • For a unit that failed, Terragrunt’s error. For a unit that stopped early, a link to the unit that failed first.
  • Show in logs shows only the unit’s lines in View Logs. It’s there when the logs tag the unit’s lines with [unit], as run --all does.
  • A plan brought back by a resumed session is badged From an earlier run — run again to refresh in the header, folded or not, since what it plans may have changed. Running the block again clears the badge.

A Command block’s View Plan panel: the plan for three units, with a destroy and a replacement first, and the attributes each update changes

For terragrunt run --all, pass --json-out-dir. Terragrunt then writes a tfplan.json for each unit, in a directory named after the unit’s path. Add --report-file to also show each unit’s result, so a unit that failed before it planned shows too:

Terminal window
terragrunt run --all --non-interactive \
--json-out-dir "$RUNBOOK_PLAN_DIR" \
--report-file "$RUNBOOK_PLAN_DIR/report.json" \
-- plan

Only pass --json-out-dir to a plan. With apply, there’s no plan for Terragrunt to convert, so every unit fails.

--json-out-dir only works with run --all. For a single unit, or for tofu on its own, save the plan and convert it with show -json. A file at the top of the directory is shown as a unit named after the file:

Terminal window
terragrunt plan -out=tfplan
terragrunt show -json tfplan > "$RUNBOOK_PLAN_DIR/vpc.json"

The panel shows the plans however the script exits, so a run where some units failed still shows what the others will change. A value the plan marks sensitive shows as (sensitive value), as does any value that contains one. The panel keeps each value to 300 characters, and says so where it cut one. Where a long value changes past that, it keeps the 300 characters around the first change, and says when it changes again past them.

While a command runs, its output streams into the collapsible View Logs panel under the block. The panel’s toolbar offers:

  • Copy log file path. Every run also writes its output to a log file in the session’s directory, which you can open or tail with other tools.
  • Copy prompt for LLM. Copies a ready-to-paste prompt for an AI assistant. It names the block’s ID, the runbook file and the log file, and ends with an instruction that matches the block’s status. When the block has failed, for example, it asks the assistant to analyze the failure and suggest a fix. The prompt points at the log file rather than including the logs, so it works best with assistants that can read local files, such as Claude Code or Cursor.
  • Search the logs. Click the search button, or click into the logs and press Cmd+F on macOS, or Ctrl+F on Windows and Linux. The search covers the whole log, including lines that arrive while it’s open, but not the timestamps. Its toggles match case (Alt+C), read the search as a regular expression (Alt+R), and show only the matching lines (Alt+L). Press Enter / Shift+Enter (or Cmd/Ctrl+G / Shift+Cmd/Ctrl+G) to move between matches, and Esc to close the search.
  • Wrap long lines, copy the logs as plain text, or download them as raw (.log) or structured (.json) logs.
  • Maximize the logs to fill the screen.

Once you scroll down a long log, a Jump to top button appears in its corner, and a Jump to bottom button appears whenever you’re above the end. After you click into the logs, Home and End do the same. While a command runs, the logs follow its output until you scroll up. The bottom button then counts the lines that have arrived since, and clicking it goes back to following.

Blocks that don’t write a log file, such as <GitClone> and <GitPullRequest>, put the last 200 lines of their logs in the prompt instead.

Commands can produce outputs that later blocks consume. Scripts write key=value pairs to the $RUNBOOK_OUTPUT file, and later blocks reference them via {{ .outputs.<block-id>.<key> }}. A later block passes one to its script with env, as in env={{ ACCOUNT_ID: "{{ .outputs.create_account.account_id }}" }}.

#!/bin/bash
ACCOUNT_ID=$(aws organizations create-account ...)
echo "account_id=$ACCOUNT_ID" >> "$RUNBOOK_OUTPUT"

Write one output per line. A key starts with a letter or underscore and contains only letters, digits and underscores. Runbooks ignores a line with any other key. See Producing outputs for the full format.

After a block runs, click View Outputs below the log viewer to inspect its outputs. To keep a credential off screen there, write sensitive: before its key, as in echo "sensitive:API_TOKEN=$TOKEN" >> "$RUNBOOK_OUTPUT". See Sensitive outputs.

For producing outputs, consuming them in templates, dependency behavior, and complex data types, see Block outputs in Inputs and outputs.