terraform-parser

Terraform Parser - Parse Terraform to JSON


License
MPL-2.0
Install
pip install terraform-parser==0.580.24088

Documentation

terraform-parser

PyPI Latest Release Build Status Coverage Status Downloads

Parse Terraform scripts into JSON

Status

Dec 2022 - This an experimental parser that can parse HCL2

Problem

I am uncertain if configuration/template language, such as Terraform, should include scripting. It is beneficial to have a simple configuration, albeit redundant, for VCS tracking and simple diff for merge reviews.

I would advocate a high level langauge (HLL), like Python, be used to produce the Terraform configuration with both HLL and Terraform be included in the repository. HLL is familiar, and the Terraform changes are easy to review.

Using an HLL for Terraform generation removes the need for the quirky template expressions, complex expressions, and modules.

The hope is to

  • parse terraform into Json data
  • merge data from different terraform to single spec
  • allow Python to modify data easily
  • write out terraform (in diff-friendly way)

References