Registry / devops / libterraform

libterraform

JSON →
library0.9.0pypypi✓ verified 80d ago

Python binding for Terraform, enabling programmatic control of Terraform workflows. Current version 0.9.0, release cadence irregular.

pip install libterraform
INSTALL
IMPORT
SIG · LIBTERRAFORM
L
libterraform
devopspythonv0.9.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

TerraformCommand
from libterraform import TerraformCommand
from libterraform import Terraform
TerraformConfig
from libterraform import TerraformConfig
ApplyResult
from libterraform import ApplyResult

Basic Terraform workflow using libterraform: init, plan, apply, and destroy.

from libterraform import Terraform # Initialize Terraform with working directory terraform = Terraform(working_dir='/path/to/terraform/config') # Run terraform init return_code, stdout, stderr = terraform.init() print('Init stdout:', stdout) # Run terraform plan return_code, stdout, stderr = terraform.plan() print('Plan stdout:', stdout) # Run terraform apply with auto-approve return_code, stdout, stderr = terraform.apply(auto_approve=True) print('Apply stdout:', stdout) # Run terraform destroy return_code, stdout, stderr = terraform.destroy(auto_approve=True) print('Destroy stdout:', stdout)
Debug
Known issues
breakingVersion 0.9.0 drops support for Python 3.8 and below. Requires Python >=3.9.
fix
Upgrade Python to 3.9+ or pin libterraform to <0.9.0 if on Python 3.8.
affects: >=0.9.0
gotchaTerraform binary must be installed and available in PATH. libterraform does not bundle Terraform.
fix
Install Terraform separately from https://www.terraform.io/downloads and ensure it's in PATH.
affects: all
gotchaMethods return a tuple (return_code, stdout, stderr) where return_code is an integer. Do not check truthiness of stdout alone for success.
fix
Always check return_code == 0 before using stdout.
affects: all
Upgrade
Version history
0.9.0latest on PyPI · released Jun 2, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
libterraform — pip install libterraform · libregistry