Language Guide

A tutorial-style guide to every construct in the function-hcl DSL.

This section walks through every feature of the function-hcl DSL, one topic at a time. Each page builds on concepts introduced earlier, so if you’re new to function-hcl, reading them in order is recommended.

The guide covers:

  1. Source Format – how HCL files are packaged as input
  2. HCL Basics – identifiers, blocks, attributes, and other fundamentals
  3. The req Variable – accessing the Crossplane request state
  4. Local Variables – defining and scoping locals
  5. Resource Blocks – declaring individual composed resources
  6. Resource Collections – creating multiple resources with for_each
  7. Groups – scoping locals to a set of resources
  8. Conditions – conditionally creating resources
  9. Composite Status – writing back to the XR status
  10. Composite Connection Details – writing connection details
  11. Resource Ready Status – controlling resource readiness
  12. Context – sharing data with downstream pipeline steps
  13. Requirements – requesting extra resources from Crossplane
  14. User-Defined Functions – writing and invoking custom functions

Source Format

How HCL source code is packaged and provided as input to function-hcl.

HCL Basics

Understanding HCL’s fundamental constructs: blocks, attributes, expressions, and identifiers.

The req Variable

Accessing the Crossplane request state with the req variable.

Local Variables

Defining and scoping local variables.

Resource Blocks

Declaring individual composed resources.

Resource Collections

Creating multiple resources with for_each.

Groups

Grouping related resources with shared locals.

Conditions

Conditionally creating resources, groups, and collections.

Composite Status

Writing values back to the composite resource status.

Composite Connection Details

Writing connection details to the composite resource.

Resource Ready Status

Controlling resource readiness.

Context

Sharing data with downstream pipeline steps.

Requirements (Extra Resources)

Requesting extra resources from Crossplane.

User-Defined Functions

Writing and invoking custom functions.

Last modified March 12, 2026: clean up docs, mostly (1ee88e8)