Add Go-backed HCL parser, auto-detect engine, batch .tf parsing#145
Open
Add Go-backed HCL parser, auto-detect engine, batch .tf parsing#145
Conversation
…grate build/tests/docs - Add tfworker/util/hcl_parser.py with auto engine selection (Go if helper on PATH; fallback to python-hcl2), forced override via TFWORKER_HCL_ENGINE/TFWORKER_HCL_BIN, and new parse_files(). - Add tools/hcl2json Go helper (go.mod, main.go) with --stdin and --multi (batch) support; unit tests including repo fixture. - Refactor tfworker/commands/config.py and tfworker/util/terraform_helpers.py to use hcl_parser; batch-parse .tf files for required_providers with graceful per-file fallback and consistent logging. - Add tests: tests/util/test_hcl_parser.py, tests/util/test_hcl_engine_parity.py (skip if helper missing), and strengthened Go tests. - Update Makefile: add go-build/go-test, build from subdir, integrate into test/ci-test, emit guidance if tools/ hcl2json/go.sum missing, clean helper binary. - Update README: engine auto-detect and forced modes, batch parsing note, Go development guidelines (commit go.mod/go.sum, tidy instructions).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Rationale
What Changed
parse_string,parse_file, and newparse_files(batch).TFWORKER_HCL_ENGINE=go|python. Forgowithout helper, raises error..tffiles and callparse_filesonce.go.modandmain.go; usesgithub.com/tmccombs/hcl2json/convert.--stdin(single) and--multi(batch) modes.versions.tf).Backwards Compatibility
Performance
How To Enable Go Parser
Testing