--- id: tftest version: "1.8.8" license: unclear license_treatment: permissive maintenance: active --- # tftest — Simple Terraform test helper License: permissive · Maintenance: active · Downloads: 116.5K/mo ## What it is and what it does tftest is a Python wrapper around the Terraform command-line tool designed to simplify testing Terraform modules. It provides a programmatic interface to run Terraform operations (init, plan, apply, destroy) and parse their outputs, making it easier to write unit tests that validate Terraform configurations without manual command execution. The package supports two testing approaches: lightweight tests using only init and plan to verify syntax and resource counts, or full integration tests that run the complete apply/output/destroy cycle and validate actual infrastructure state. It includes a caching mechanism to speed up repeated test runs by storing and reusing command outputs based on file content hashes, and provides convenience classes to access plan variables, outputs, resources, and modules in a structured way. Use it for: - Validate Terraform module syntax and resource definitions in CI/CD pipelines before deployment. - Test that Terraform configurations produce the expected number and type of resources via plan output inspection. - Verify Terraform outputs and state file contents after applying configurations to actual infrastructure. - Cache expensive Terraform operations during test development to reduce iteration time. - Programmatically inspect plan resources and module structure from Python test code. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Wraps the Terraform executable to facilitate testing Terraform modules from Python unit tests, exposing methods to set up fixtures, execute Terraform commands, and parse their output. Yes. tftest is actively maintained, has no external runtime dependencies, carries a permissive license, and solves a clear problem for teams testing Terraform infrastructure-as-code. The caching feature and structured output parsing add practical value. Install it if you write Python tests for Terraform modules. ## Install pip install tftest uv add tftest poetry add tftest ## Installing tftest Before you install: Low install friction with no runtime dependencies. Actively maintained as of 2026-06-29 with a recent release cycle. License in practice: Licensed under Apache Software License (permissive), allowing use in commercial and proprietary projects without significant restriction. Quickstart: pip install tftest import tftest tf = tftest.TerraformTest('plan', 'path/to/terraform') tf.setup() plan = tf.plan(output=True) Terraform binary must be installed and available on the system PATH; Terraform 0.12 or later is required. Verify before relying: - Whether caching feature works reliably across different Terraform versions and file system states. - Performance characteristics when testing large or complex Terraform modules. - Compatibility with recent Terraform versions beyond 0.12. ## Package facts - License: not declared (permissive) - Python support: unspecified - Install friction: low - Maintenance: active - Downloads: 116.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags terraform testing python, terraform unit test helper, terraform plan output parsing, terraform module testing, terraform apply test framework, terraform state testing python, terraform fixture setup, terraform, infrastructure-as-code, testing [View on SkillFed](https://skillfed.io/packages/tftest) · [View on PyPI](https://pypi.org/project/tftest/)