-
Notifications
You must be signed in to change notification settings - Fork 5
Add HCL parser support (.tf, .tfvars) #134
Description
Problem
Ix does not currently parse .tf or .tfvars files. HCL (HashiCorp Configuration Language) files are treated as unrecognized and excluded from analysis, meaning infrastructure definitions, resource configurations, and environment variables managed through Terraform are invisible to the system.
Proposed solution
Add an HCL parser that can identify and extract:
- Resource blocks (e.g.
resource "aws_s3_bucket" "my_bucket") - Data source blocks (e.g.
data "aws_ami" "example") - Variable and output declarations
- Module references (e.g.
module "vpc") - Provider configurations
- Locals blocks
*.tfvarsvariable assignments
Support the following file patterns: *.tf, *.tfvars
Why it matters
Terraform is the standard tool for infrastructure-as-code. In infrastructure-heavy repos, .tf files describe the entire cloud environment — networking, compute, storage, IAM, and more. Without parsing HCL, Ix cannot reason about infrastructure topology, trace how application code relates to the resources it depends on, or surface misconfigurations and dependencies across the stack. This is especially critical for a tool operating in an infrastructure context.
Merge requirements
Before this can be merged to main, the following must pass:
- Tested on 3 repos
- No regressions on existing parsers (
ix mapon a known TS/JS repo, verify counts unchanged) - Unit + smoke tests pass (
npm testinix-cli) -
resourceblocks ingested as entities with type and name labels -
datasource blocks ingested as entities -
variableandoutputdeclarations ingested -
modulereferences ingested and linked to their source where possible -
providerandlocalsblocks ingested -
.tfvarsvariable assignments ingested and linked to their declared variable where possible - CONTAINS chains correctly: file → resource/module → nested block
-
ix textreturns results withlanguage: hcl -
ix containsreturns members for a known.tffile