Skip to main content

Meta-schema reference

This page is generated from schema/draft/2026-09/.schema.hcl by hclschema docs — the same command you would run against your own schema.

Meta-schema​

Draft 2026-09.

AttributeTypeRequiredDefaultDescription
__idstringyesA stable identity for this document.
__schemastringyesThe meta-schema this document is written against. Its draft/<id>/ path segment selects the draft.
__schema_sha256string
matching ^[0-9a-fA-F]{64}$
noPins the meta-schema to an exact digest.

import​

Makes another schema's ids available under an alias, as alias.block_header.<id>.

import "<alias>" { ... }

Labels must be unique among sibling blocks of this type.

AttributeTypeRequiredDefaultDescription
sourcestringyesA path relative to this document, or an https URL.
sha256string
matching ^[0-9a-fA-F]{64}$
noPins the imported document to an exact digest.

body​

The root body every instance of this schema must match.

body { ... }

Occurrences: at most 1.

AttributeTypeRequiredDefaultDescription
openboolnoPermit attributes and blocks this body does not declare.

body.attribute​

Declares an attribute. Mirrors hcl.AttributeSchema, extended with hcldec.AttrSpec's type and default.

attribute "<attribute_name>" { ... }

Labels must be unique among sibling blocks of this type.

AttributeTypeRequiredDefaultDescription
at_least_one_oflist(string)noThis attribute and the named siblings form a group of which at least one must be set.
conflicts_withlist(string)noSibling attributes that must not be set alongside this one.
defaultanynoSubstituted when the attribute is absent. Only meaningful when it is optional.
deprecatedstringnoMarks the attribute deprecated, with the reason. Using it produces a warning.
descriptionstringnoDocumentation, surfaced as editor hover text and in generated reference docs.
enumanynoThe permitted values.
exactly_one_oflist(string)noThis attribute and the named siblings form a group of which exactly one must be set.
maxnumbernoUpper bound on a number's value, a string's length, or a collection's element count.
minnumbernoLower bound on a number's value, a string's length, or a collection's element count.
patternstringnoA regular expression a string value must match.
requiredboolnoThe attribute must be present.
required_withlist(string)noSibling attributes that must be set when this one is.
sensitiveboolnoKeeps the value out of diagnostics.
typeanynoA type constraint expression, as understood by ext/typeexpr.
body.attribute.validation​

A custom predicate over the attribute's value.

validation { ... }
AttributeTypeRequiredDefaultDescription
conditionanyyesA boolean expression with self bound to the value.
error_messagestringyesReported when the condition is false.

body.block_header​

Declares a block. Mirrors hcl.BlockHeaderSchema, extended with hcldec's cardinality.

block_header "<block_header_type>" { ... }

Labels must be unique among sibling blocks of this type.

AttributeTypeRequiredDefaultDescription
deprecatedstringnoMarks the block deprecated, with the reason.
descriptionstringno
idanynoRegisters this block's body so that a ref elsewhere can reuse it.
label_nameslist(string)noNames for the block's positional labels. Their count is the block's arity.
max_itemsnumber
at least 0
noMost instances permitted. Zero means unbounded.
min_itemsnumber
at least 0
noFewest instances of this block permitted in its parent body.
openboolnoPermit content this block's body does not declare.
refanynoReuses the body registered under another declaration's id, as block_header.<id>.
requiredboolnoShorthand for min_items = 1.
unique_labelsboolnoSibling blocks of this type must not repeat a label tuple.
body.block_header.label​

Constrains one positional label. Mirrors hcldec.BlockLabelSpec, extended with a pattern and an enum.

label "<label_name>" { ... }

Labels must be unique among sibling blocks of this type.

AttributeTypeRequiredDefaultDescription
descriptionstringno
enumlist(string)noThe permitted labels.
patternstringnoA regular expression the label must match.
body.block_header.body​
body { ... }

Same contents as body.

body.one_of​

A group of alternatives, exactly one of which the enclosing body must match.

one_of { ... }
body.one_of.variant​
variant "<variant_name>" { ... }

Occurrences: at least 2.

Labels must be unique among sibling blocks of this type.

body.one_of.variant.body​
body { ... }

Same contents as body.