Error: Invalid single-argument block definition
Fixes Terragrunt's 'Error: Invalid single-argument block definition' by closing single-line blocks on the same line. Use when an argument sits on the same line as its block opening without a closing brace. Not for genuinely malformed HCL elsewhere.
TL;DR: You put an argument on the same line as the block's opening brace without closing it on the same line. HCL treats that as a single-line block definition, which must open AND close on one line. Either close it there or move the argument to its own line.
Error: Invalid single-argument block definition
on terragrunt.hcl line 1, in terraform:
1: terraform { source = "./mod"
2: inputs = { a = }
An argument definition on the same line as its containing block creates a
single-line block definition, which must also be closed on the same line.Steps
- Run
terragrunt hcl validate.
Expected: it points at the exact line (better than guessing).
- Fix the block: either close it on the same line (
terraform { source = "./mod" }) or put the argument on its own line inside a multi-line block.
Expected: braces balance.
- Run
terragrunt hcl fmt --check --difffor formatting.
Expected: clean.
- Re-run your command.
Expected: the parse error is gone.
When this applies
Invalid single-argument block definitionnaming a block with an argument on the opening line.- Any HCL syntax error in
terragrunt.hcl/root.hcl: the validator path is the same.
When it doesn't apply
- The file parses but a VALUE is wrong (unknown attribute, type mismatch): those are evaluation errors;
terragrunt rendershows the resolved config. ${...}inside agenerateheredoc being eaten by Terragrunt: that's the generate-template trap (escape as$${...}), not a syntax error.
Tool versions
All Terragrunt versions (HCL syntax).
Why it happens
HCL has two block forms: single-line (block { arg = x }) and multi-line. An argument on the opening line selects the single-line form, so a missing closing brace on that line is a syntax error, not just bad style.
Edge cases
- Two Terragrunt-specific traps that LOOK like generic HCL errors:
values.*unbound outside a generated unit (validate the materialized unit afterterragrunt stack generate, not the catalog source), and${...}ingenerateheredocs evaluated by Terragrunt instead of passed through.
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.