Skip to content
Testaroo
hcl1.2 KB

HCL2 Orchestrator Job Definition

A deeply nested HCL2 job definition (job, group, task, service, check) with duration strings, a port mapping, and restart and update policies. Four levels of block nesting, which is where hand-rolled HCL readers usually break.

Preview, first 50 lineshcl
# Generic HCL2 orchestrator job definition. Inert: every task references a fictional image and
# no command does anything outside the described container.
job "orders-api" {
  region      = "eu-example-1"
  datacenters = ["dc-example-1", "dc-example-2"]
  type        = "service"
  priority    = 60

  update {
    max_parallel      = 2
    min_healthy_time  = "30s"
    healthy_deadline  = "5m"
    auto_revert       = true
    canary            = 1
  }

  group "api" {
    count = 3

    network {
      mode = "bridge"

      port "http" {
        to = 8080
      }
    }

    restart {
      attempts = 3
      interval = "10m"
      delay    = "30s"
      mode     = "fail"
    }

    task "server" {
      driver = "docker"

      config {
        image = "registry.example.invalid/example-org/orders:1.4.0"
        ports = ["http"]
      }

      env {
        LOG_LEVEL = "info"
        TIER      = "standard"
      }

      resources {
        cpu    = 500
        memory = 512
… 67 lines total: download for the full file.

Specifications

Grammar
HCL2
Nesting Depth
4
Blocks
11
Groups
1
Tasks
1
Duration Strings
6

Testing contract

Expected to pass
Scenario
Walk a four-level HCL2 block tree and read attributes from the innermost blocks
Expected result
The check block inside service inside task inside group inside job resolves, reporting interval 10s and path /healthz

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 Orchestrator Job Definition” is a deterministic Testaroo fixture for Config testing, Config parsing, Syntax highlighting. TOML, INI, YAML, .env, and dotfile configuration samples with nested sections and typed values, for testing config parsers, loaders, and environment tooling.

Documented properties for this file: HCL · 1,223 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.

Point your config loader at the file and assert it reads the documented sections and typed values, including any deliberately-tricky nesting or comments.

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