All Tools View Categories About Contact Privacy

Terraform HCL Linter / Validator

Validate pasted Terraform (.tf) HCL for unbalanced braces, unclosed strings and duplicate resources.

Runs entirely in your browser - nothing is uploaded and no cloud connection is made.
0
errors
0
warnings
0
info
Your validation report will appear here.

About Terraform HCL Linter / Validator

The Terraform HCL Linter is a fast, private first pass over your configuration. It parses pasted .tf and reports the structural problems that cause terraform plan and terraform apply to fail: unbalanced braces, unclosed string literals, duplicate resource addresses and resource blocks that are missing their type or name labels. Running it before you commit saves a round trip through CI and catches the typos that are easy to miss by eye.

Every check runs locally in your browser, so your code never leaves the machine and nothing is uploaded to any server. The linter is not a replacement for terraform validate, which has the full provider schema, but it is the quickest way to confirm a file is at least syntactically sound. Use it while you write, after a merge, or as a teaching aid when someone is learning HCL and wants to see what well-formed configuration actually looks like.

The linter also helps teams enforce a baseline before code review. A quick paste catches the obvious mistakes so reviewers can focus on design rather than syntax. Because the report is plain Markdown, you can paste it directly into a pull request comment, and because the findings are also available as JSON you can wire the output into a custom gate or dashboard without screen scraping.

Common problems the linter catches include a missing closing brace after a long resource, a string that was opened but never closed because of a stray quote, and two modules that both declare a resource named default so the addresses collide. All three are easy to introduce during a large refactor and just as easy to overlook until terraform apply fails hours later.

Features

  • Brace balance - counts open and close braces and reports exactly how many are missing.
  • Quote balance - flags an odd number of double quotes that would break a string.
  • Duplicate addresses - detects two resources with the same type.name.
  • Label checks - warns when a resource block lacks its type or name label.
  • Severity grading - each finding is INFO, WARNING or ERROR.
  • Summary stats - a live count of errors, warnings and info.
  • HCL parse - uses the shared tfParse engine for accurate block detection.
  • Markdown report - the report is ready to paste into a pull request.
  • Copy and download - export as Markdown or copy the text.
  • JSON export - copy the raw findings as JSON for tooling.
  • Private - parsed entirely in the browser.
  • Responsive layout - collapses to one column on small screens.
  • Empty input guard - tells you to paste configuration instead of failing silently.
  • Parse error capture - surfaces messages from the parser when a file is badly formed.
  • Resource naming - confirms each resource has a usable address for state tracking.
  • Cross file - works on a full module pasted as one text block.
  • Deterministic - the same input always yields the same findings.

How to Use

  1. Paste your .tf configuration into the text area.
  2. Click Validate to run the structural checks.
  3. Read the findings grouped by ERROR, WARNING and INFO severity.
  4. Fix the errors first - they are the ones that block a real apply.
  5. Use the stats row to gauge how many issues remain.
  6. Copy the report as Markdown for a review comment.
  7. Copy JSON if you want to feed the findings into another tool.
  8. Download the Markdown or print it for your records.
  9. Load the sample to see a clean configuration pass with only INFO.

Examples

Paste a block such as resource "aws_s3_bucket" "data" { bucket = "example" } followed by a second resource "aws_s3_bucket" "data" with the same address. The linter reports a duplicate resource address as an ERROR and a clean INFO line counting the two resources parsed. Remove the duplicate and re-run: the ERROR disappears and you are left with a single INFO summary, confirming the file is structurally valid before you run terraform validate.

You can also test malformed input on purpose. Delete the closing brace of a block and Validate reports an unbalanced braces ERROR with the exact count of missing closing brackets. The stats row then shows one error and zero warnings, which is exactly the signal a pre-commit hook would act on. Restoring the brace clears the error and the report returns to a single INFO line, proving the file is sound again.

Benefits

  • Fast feedback - catch syntax errors before CI.
  • No secrets sent - everything stays local.
  • Clear report - severity-graded Markdown.
  • JSON for tools - pipe findings into automation.
  • Teaches HCL - learn what well-formed config looks like.
  • CI friendly - the JSON output slots into automated quality gates.

Frequently Asked Questions

What does the linter check?
It scans for unbalanced braces, unclosed string literals, duplicate resource addresses, and missing resource labels, then reports INFO/WARNING/ERROR findings.
Does it replace terraform validate?
No. It is a fast client-side structural check. Run terraform validate in CI for authoritative validation.
Does it upload my code?
No. Everything is parsed locally and nothing leaves your browser.
What is a duplicate resource address?
Two resource blocks with the same type.name (e.g. aws_s3_bucket.data declared twice) - Terraform cannot apply that.
Can I export the report?
Yes. Copy, download as .md, or print the findings.