Skip to main content

Python HCL/Terraform parser via extension for AquaSecurity defsec

Project description

What

A python extension for parsing and evaluating terraform using defsec.

While terraform uses HCL as its configuration format, it requires numerous forms of variable interpolation, function and expression evaluation, which is beyond the typical usage of an hcl parser. To achieve compatiblity with the myriad real world usages of terraform, this library uses the canonical implementation from terraform, along with the interpolation and evaluation from defsec to offer a high level interface to parsing terraform modules.

Installation

pip install tfparse

We currently distribute binaries for MacOS (x86_64, arm64) and Linux (x86_64, aarch64).

Usage

A terraform module root, with terraform init having been performed to resolve module references.

from tfparse import load_from_path
parsed = load_from_path('path_to_terraform_root')
print(parsed.keys())

Building

  • requires a modern golang (1.18)
python setup.py develop

Credits

aquasecurity/defsec - golang module for parsing and evaluating terraform hcl

Scalr/pygohcl - python bindings for terraform hcl via golang extension

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

tfparse-0.1.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

tfparse-0.1.3-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (7.4 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

tfparse-0.1.3-cp310-cp310-macosx_11_0_arm64.whl (7.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

tfparse-0.1.3-cp310-cp310-macosx_10_9_x86_64.whl (7.3 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file tfparse-0.1.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for tfparse-0.1.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c6e5d9b01b807c96c70ed8b342a46686c0e477266e2479c4cf9b15fe0e58e1ea
MD5 444d3f57e36ccb7d37949e201093495d
BLAKE2b-256 84439a90754e706e99df9a9ab7f58eef5d0ea415f8cdb32d5c1062c4536c541c

See more details on using hashes here.

File details

Details for the file tfparse-0.1.3-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tfparse-0.1.3-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 29d466c3dace725b2b5c7905e8a4f472b51c63abed5426b27b3e3a584fac7819
MD5 96c437990c6a5b5d74640162635f5138
BLAKE2b-256 2d5b6a5f911e3bcdfc9cc28107964da9a289759ab05dab9dadf2eb82e6ad337a

See more details on using hashes here.

File details

Details for the file tfparse-0.1.3-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for tfparse-0.1.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 90dd576bd1b5ac093b78b4041fa54352318b22c425f3ff7c565da8088de0dcbf
MD5 7101de38dc68755b9fb30b3f8972c1ca
BLAKE2b-256 4e94b752f4780d382bfe931b55e3dfaf94a37d450c4d91101a0cee525b0ee876

See more details on using hashes here.

File details

Details for the file tfparse-0.1.3-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for tfparse-0.1.3-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f6bd58cac7de1e07f02a9c0eb824b5e7d0963814d966c969fafdc1d1bd7c63d5
MD5 0091889e4c6de9e5179931c2957ef057
BLAKE2b-256 421ac90ecacefedf2b4a45ba0086ae0a67412b30539642c524e08f630f471a3a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page