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.4-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.4-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.4-cp310-cp310-macosx_11_0_arm64.whl (6.8 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

tfparse-0.1.4-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.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for tfparse-0.1.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 93ac3da3a567e4cde12d609db34b1e7754f00bf3ba1abed967c4bd699b4d10d0
MD5 38a0216a4064df36729a65bb4aa9e18a
BLAKE2b-256 237aef1570d510da186cd81b6a1a85d09d429c8d848ad963faa46216195fa26f

See more details on using hashes here.

File details

Details for the file tfparse-0.1.4-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.4-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 90e5f6876ced9b029eb2693be47277231ee7679b2e806b1675732d38d9423649
MD5 d9204b51936f784dca8f20a4d387287e
BLAKE2b-256 f19cb8fe2c70d79d240d64b7e559d9010e5c6f3d00915d40cfa2a483ec016848

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tfparse-0.1.4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 520c7443fb2e38927014474e7c1fb8082c944a58a0d4ee3289511974315a5472
MD5 57b7d814f7893aba7247e41f077e4c0d
BLAKE2b-256 f5e281bbfe0656b48c21e4dd97cd2bf3d5eb7f9e2d62be0cfe6939a10988f22b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tfparse-0.1.4-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f42afdc056f136ef45fce7beda9d16fc6e3b9433f080a31f8bb3d5d2848c9fb6
MD5 5d5bd62561c47062281daf786f5990cf
BLAKE2b-256 bf6b27e06a0e38446b740130bf20d10c4675f8a1ce1cbaf55352164aca3d8991

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