Skip to content
Testaroo
hcl462 B

HCL2 Document, Intentionally Invalid

An intentionally invalid HCL2 document: an unclosed block, a colon assignment, a half-quoted block label, and a heredoc whose terminator is misspelled so it swallows the remainder of the file. Four documented faults, each a distinct recovery test.

Preview, first 16 lineshcl
# INTENTIONALLY INVALID. Four documented faults for an HCL2 parser:
#   1. the `group` block is never closed
#   2. an attribute uses `:` instead of `=`
#   3. a heredoc opens with <<EOT but the terminator is misspelled, so it swallows the rest
#   4. a block label is quoted on one side only
job "broken" {
  type: "service"

  group "api {
    count = 2

    notes = <<EOT
      this heredoc never terminates because the marker below is misspelled
    EOF
  }

Specifications

Variant
intentionally invalid
Faults
4
Braces Balanced
false
Unterminated Heredoc
true

Testing contract

Expected to fail
Scenario
Recover from an HCL2 heredoc whose terminator never appears
Expected result
Parsing fails with an unterminated-heredoc or unexpected-EOF error, and does not silently return a partial document

What is a .hcl file?

HCL (HashiCorp Configuration Language) is the block-structured configuration language behind Terraform, Packer, Nomad, Consul, and Vault. A document is a sequence of attributes (`name = expression`) and blocks (a type, zero or more string labels, and a braced body), with support for heredocs, function calls, conditionals, and for-expressions. It is designed to be both hand-written and machine-generated, and has a documented JSON-equivalent syntax.

How to use this file

Use an example .hcl file to test HCL parsers, configuration linters, and JSON-syntax converters, exercising nested blocks with multiple labels, heredoc indentation, and comment styles (`#`, `//`, and `/* */`).

How to use this file for testing

“HCL2 Document, Intentionally Invalid” is a deterministic Testaroo fixture for Error handling, Config parsing, Schema validation. Deliberately corrupt and invalid files, clearly labelled, for testing how your tool fails.

Documented properties for this file: HCL · 462 bytes. Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.

Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such, expect parsers to fail loudly rather than silently accept them.

Pipeline and infrastructure fixtures are inert configuration: steps reference fictional images and scripts, and nothing here executes. Run your linter, schema validator, migrator, or policy engine against them, and expect the deprecated-syntax and intentionally invalid variants to be rejected.

Generated by generation/pipelines.py. Free for any use, no attribution required, license.