<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Concepts on function-hcl</title><link>https://crossplane-contrib.github.io/function-hcl/docs/concepts/</link><description>Recent content in Concepts on function-hcl</description><generator>Hugo</generator><language>en</language><atom:link href="https://crossplane-contrib.github.io/function-hcl/docs/concepts/index.xml" rel="self" type="application/rss+xml"/><item><title>How It Works</title><link>https://crossplane-contrib.github.io/function-hcl/docs/concepts/how-it-works/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://crossplane-contrib.github.io/function-hcl/docs/concepts/how-it-works/</guid><description>&lt;h2 id="the-crossplane-function-pipeline"&gt;The Crossplane Function Pipeline&lt;/h2&gt;
&lt;p&gt;Crossplane composition functions run as steps in a pipeline. Each step receives the current desired state,
may modify it, and passes it on to the next step. function-hcl is one such step.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Crossplane
 |
 v
+---------------------+
| function-hcl | &amp;lt;-- reads req.composite, evaluates HCL, writes desired resources
+---------------------+
 |
 v
 (next function or final reconcile)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id="what-function-hcl-does"&gt;What function-hcl Does&lt;/h2&gt;
&lt;p&gt;When Crossplane calls function-hcl, it:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Unpacks the input&lt;/strong&gt; &amp;ndash; reads the HCL scripts from the Composition pipeline step&amp;rsquo;s &lt;code&gt;input&lt;/code&gt; field.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Evaluates the HCL&lt;/strong&gt; &amp;ndash; runs the script with access to the current composite resource, observed resources, and context.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Builds desired resources&lt;/strong&gt; &amp;ndash; each &lt;code&gt;resource&lt;/code&gt; block that evaluates successfully contributes a desired composed resource to the output. Each &lt;code&gt;resources&lt;/code&gt; block produces additional resources in the desired state.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Defers incomplete blocks&lt;/strong&gt; &amp;ndash; resource blocks that contain &lt;a href="../../language-guide/hcl-basics/#incomplete-values"&gt;incomplete values&lt;/a&gt; (e.g. a status field from a resource that hasn&amp;rsquo;t been created yet) are &lt;em&gt;silently deferred&lt;/em&gt; rather than causing an error.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Writes back status / connection details / context&lt;/strong&gt; &amp;ndash; &lt;code&gt;composite status&lt;/code&gt;, &lt;code&gt;composite connection&lt;/code&gt;, and &lt;code&gt;context&lt;/code&gt; blocks write values back to the composite resource or pipeline context.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="the-reconcile-loop"&gt;The Reconcile Loop&lt;/h2&gt;
&lt;p&gt;Crossplane runs composition functions repeatedly as the state of the world changes. This is important for
understanding function-hcl&amp;rsquo;s behavior:&lt;/p&gt;</description></item><item><title>Deferred Rendering</title><link>https://crossplane-contrib.github.io/function-hcl/docs/concepts/deferred-rendering/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://crossplane-contrib.github.io/function-hcl/docs/concepts/deferred-rendering/</guid><description>&lt;p&gt;Deferred rendering is the headline feature of function-hcl. It eliminates the boilerplate
conditional logic that is common in Crossplane compositions.&lt;/p&gt;
&lt;h2 id="the-problem"&gt;The Problem&lt;/h2&gt;
&lt;p&gt;In a typical Crossplane composition, if resource B uses a status field from resource A, you need to handle
the case where resource A hasn&amp;rsquo;t been created yet. This often requires conditional logic
scattered throughout your composition.&lt;/p&gt;
&lt;h2 id="how-function-hcl-solves-it"&gt;How function-hcl Solves It&lt;/h2&gt;
&lt;p&gt;function-hcl uses a simple rule: if &lt;strong&gt;any expression&lt;/strong&gt; in a block evaluates to an
&lt;a href="../../language-guide/hcl-basics/#incomplete-values"&gt;incomplete value&lt;/a&gt; (null, missing attribute,
missing index), the &lt;strong&gt;entire block is deferred&lt;/strong&gt; — dropped from the output for that reconcile cycle.&lt;/p&gt;</description></item></channel></rss>