Composition functions
Real logic in compositions.
Early Crossplane compositions were static patch-and-transform, which struggles with real logic — loops, conditionals, computed values. Composition functions fix that: a composition can call one or more functions (containers implementing a gRPC interface) that receive the observed state and the desired composite, run arbitrary logic, and return the set of resources to create. It is the difference between a fixed template and a program that decides what to provision.
apiVersion: apiextensions.crossplane.io/v1kind: Compositionmetadata: { name: postgres-aws }spec:mode: Pipeline # function-based compositioncompositeTypeRef: { apiVersion: acme.io/v1alpha1, kind: XPostgresInstance }pipeline:- step: buildfunctionRef: { name: function-patch-and-transform }- step: replicas-by-sizefunctionRef: { name: function-go-templating } # loops/conditionals in a template
What this unlocks
With functions you can create a variable number of resources (N read replicas from a count), branch on inputs (add a WAF only in prod), pull data from elsewhere, and validate the composite before anything is provisioned. Functions are packaged and versioned like providers, and you compose several into a pipeline where each step transforms the desired state — turning compositions into genuinely programmable platform logic.