Skip to content
Novus Examples
tf554 B

Terraform Configuration, Intentionally Invalid

An intentionally invalid Terraform configuration: an unclosed resource block, a colon where HCL needs an equals sign, a reference to an undeclared resource, and a resource block missing its second label. Four documented faults for a parser to report.

Preview — first 14 linestf
# INTENTIONALLY INVALID. Four documented faults for an HCL2 parser or `terraform validate`:
#   1. the `examplecloud_network` resource block is never closed
#   2. `cidr_block` is assigned with `:` instead of `=`
#   3. a reference points at a resource that is not declared anywhere
#   4. a block label is missing on the second resource
resource "examplecloud_network" "main" {
  name       = "broken"
  cidr_block: "10.20.0.0/16"

resource "examplecloud_instance" {
  subnet_id = examplecloud_subnet.does_not_exist.id
  size      = var.instance_size
}

Specifications

Variant
intentionally invalid
Faults
4
Braces Balanced
false

Testing contract

Expected to fail
Scenario
Parse an HCL2 document whose block nesting does not balance
Expected result
Parsing fails with a syntax error rather than silently accepting the truncated block, and the colon assignment is reported separately from the unbalanced braces

What is a .tf file?

A .tf file is a Terraform configuration written in HCL. It declares infrastructure as blocks — terraform, provider, resource, data, variable, output, module, locals — whose bodies hold arguments and nested blocks, with values drawn from expressions, interpolation, and functions. Terraform reads every .tf file in a directory as one merged configuration, so ordering across files carries no meaning.

How to use this file

Use an example .tf file to test HCL parsers, infrastructure linters and policy engines, and configuration migrators, checking block-and-label parsing, heredoc strings, expression references between resources, and that a deprecated-syntax file is flagged rather than silently accepted.

How to use this file for testing

“Terraform Configuration, Intentionally Invalid” is a deterministic Novus Examples 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: TF · 554 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.