--- id: tfparse version: "0.6.20" license: Apache-2.0 license_treatment: permissive maintenance: active --- # tfparse — Python HCL/Terraform parser via extension for AquaSecurity defsec License: permissive · Maintenance: active · Downloads: 156.6K/mo ## What it is and what it does tfparse is a Python extension that wraps Go bindings to Terraform's canonical HCL parser and the defsec evaluation engine. It handles the full complexity of Terraform configuration parsing, including variable interpolation, function evaluation, and expression resolution—going beyond what a standard HCL parser can do. The library exposes a high-level Python interface to load and inspect parsed Terraform modules as dictionaries. The package is built on cffi bindings to Go code and ships precompiled wheels for common platforms. It is intended for developers who need to programmatically analyze or process Terraform configurations in Python, such as linting tools, policy engines, or infrastructure scanning utilities. Use it for: - Analyze Terraform modules programmatically to extract resource definitions and validate configurations. - Build policy-as-code or compliance scanning tools that need to understand Terraform state and expressions. - Integrate Terraform parsing into Python-based infrastructure-as-code tooling or CI/CD pipelines. - Extract metadata from Terraform modules for documentation generation or dependency mapping. - Validate Terraform configurations before deployment by inspecting parsed structure and values. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. tfparse parses and evaluates Terraform HCL configuration files using Go bindings to the canonical Terraform implementation and defsec evaluation engine. Yes, if you need to parse and evaluate Terraform configurations in Python. The package is actively maintained, has no known vulnerabilities, and uses a permissive license. Install friction is moderate due to compiled extensions, but prebuilt wheels cover common platforms. Note the Windows memory management caveat if that is a deployment target. ## Install pip install tfparse uv add tfparse poetry add tfparse ## Installing tfparse Before you install: Medium install friction due to compiled C extensions (cffi-based bindings to Go). Prebuilt wheels available for Python 3.10–3.14 on macOS (x86_64, arm64), Linux (x86_64, aarch64), and Windows. Active maintenance with a recent release. License in practice: Apache-2.0 permissive license allows use in most commercial and open-source projects without significant restrictions. Quickstart: pip install tfparse from tfparse import load_from_path parsed = load_from_path('path_to_terraform_root') print(parsed.keys()) Requires terraform init to have been run on the target directory to resolve module references. Verify before relying: - Memory management on Windows (documentation notes memory is not freed on parse results; impact on long-running or high-volume parsing unclear). - Exact scope of Terraform version compatibility and which HCL2 features are fully supported. - Performance characteristics and scalability limits for large module hierarchies. ## Package facts - License: Apache-2.0 (permissive) - Python support: unspecified - Install friction: medium - Maintenance: active - Downloads: 156.6K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags terraform hcl parser, parse terraform modules, terraform configuration parsing, hcl evaluation, terraform ast extraction, infrastructure as code parsing, terraform file analysis, terraform, infrastructure-as-code, hcl-parser [View on SkillFed](https://skillfed.io/packages/tfparse) · [View on PyPI](https://pypi.org/project/tfparse/)