Skip to content

Terraflow

GitHub go.mod Go version Go Report Card GoDoc GitHub Release GitHub Actions Workflow Status Discord X (formerly Twitter) Follow

Terraflow is a real-time development solution for Terraform and OpenTofu, letting you explore and understand your infrastructure as you code.

While traditional Terraform debugging feels disconnected, Terraflow introduces a liquid approach, turning Terraform development into a continuously responsive experience.

You edit code, Terraflow reflects the changes.

Features

Live Updates: The console automatically refreshes when you modify .tf or .tfvars files. Edit your Terraform configuration, and the console immediately reflects the changes.

Tab Autocompletion: Press Tab to cycle through available completions for variables, locals, resources, modules, and functions. Press Shift+Tab to cycle backward through suggestions.

Command History: All executed commands are persisted. Use the up and down arrow keys to navigate through your command history across sessions.

Multiline Expressions: Paste complex multiline Terraform expressions directly into the console. The console automatically handles formatting and evaluation.

Suggestions: As you type, the console displays inline suggestions based on your command history and available Terraform functions. Press the right arrow at the end of a line to accept a suggestion.

Installation

From the Binary Releases

  1. Download the latest release from the Releases page.
  2. Unpack it tar -zxvf terraflow_0.1.1_darwin_arm64.tar.gz
  3. Move the binary from the unpacked directory to its desired destination mv terraflow_0.1.1_darwin_arm64/bin/terraflow /usr/local/bin/terraflow

Usage

Basic Usage

Run the following command in the Terraform project directory to start the interactive console.

$ terraflow console

Getting Started

  1. Navigate to your Terraform project directory:
$ cd /path/to/your/terraform/project
  1. Start the console:
$ terraflow console
  1. Try evaluating some expressions:
>> var.some_var
"initial"

>> upper("hello world")
"HELLO WORLD"

>> local.environment
"production"
  1. Exit the console:
>> exit

Or press Ctrl+D.

Command-Line Options

$ terraflow console [options]
Option Description
-var-file=path Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.
-backend-config=path Configuration to be merged with what is in the configuration file's 'backend' block. This can be either a path to an HCL file with key/value assignments (same format as terraform.tfvars) or a 'key=value' format, and can be specified multiple times. The backend type must be in the configuration itself.
-pull-remote-state Pull the remote state from its location.

Keyboard Shortcuts

Shortcut Action
Tab Cycle forward through completions
Shift+Tab Cycle backward through completions
Right Arrow Accept suggestion
Up / Down Arrows Navigate command history
Ctrl+C Clear current input and show fresh prompt
Ctrl+D or exit Exit the console

Examples

Evaluate variables:

$ terraflow console -var-file=production.tfvars
>> var.instance_type
"t3.large"

>> var.region
"us-west-2"

Work with remote state:

$ terraflow console -backend-config=backend.hcl -pull-remote-state

This pulls the current remote state so you can query real deployed resources and data sources.

Complex expressions:

The console supports multiline expressions, just paste them in:

>> [for x in ["hello", "world"]:
..   upper(x)
.. ]
[
  "HELLO",
  "WORLD",
]

Contributing to Terraflow

See Contribution guide for workflow and guidelines.

License

See the LICENSE file.

About

Terraflow is a real-time development solution for Terraform and OpenTofu, letting you explore and understand your infrastructure as you code.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages