terraform-local
raw JSON → 0.26.0 verified Fri May 01 auth: no python
A thin wrapper script that runs Terraform against LocalStack, enabling local development and testing of Terraform configurations without cloud resources. Current version: 0.26.0. Release cadence is irregular, mostly following upstream Terraform and LocalStack changes.
pip install terraform-local Common errors
error tflocal: command not found ↓
cause The package is installed but the executable is not in PATH, or the package isn't installed correctly.
fix
Verify installation: pip install terraform-local. Check if ~/.local/bin is in PATH, or run pip show terraform-local to locate the script.
error Error: Failed to instantiate provider "aws" to obtain provider version and schema: fork/exec /usr/local/bin/terraform: no such file or directory ↓
cause terraform-local expects Terraform binary (terraform) to be installed and in PATH.
fix
Install Terraform CLI from https://www.terraform.io/downloads and ensure 'terraform' is available in your PATH.
error ImportError: No module named 'tflocal' ↓
cause Attempting to import tflocal as a Python module, but it is a CLI script.
fix
Do not import; use subprocess.run(['tflocal', ...]) or run from shell.
Warnings
gotcha terraform-local is a CLI tool, not a Python library. It has no Python importable modules. Attempting 'from tflocal import ...' fails. Use subprocess or shell commands. ↓
fix Use subprocess.run(['tflocal', 'command']) or run 'tflocal' directly in terminal.
deprecated Older versions used the command 'tflocal' with different flags. The 0.26.x series aligns with Terraform 1.x CLI flags. Check documentation if you experience flag errors. ↓
fix Upgrade to latest version and refer to Terraform CLI docs for flags.
gotcha The pip package name is 'terraform-local', but the CLI command is 'tflocal'. This can cause confusion when looking for the executable. ↓
fix After pip install, use 'tflocal' on the command line, not 'terraform-local'.
Quickstart
# No Python API; use CLI tool 'tflocal'
# Ensure LocalStack is running
import subprocess
subprocess.run(['tflocal', 'init'])
subprocess.run(['tflocal', 'apply', '-auto-approve'])