<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Terraform folder structure and states in Administration &amp; Architecture</title>
    <link>https://community.databricks.com/t5/administration-architecture/terraform-folder-structure-and-states/m-p/152063#M5072</link>
    <description>&lt;P&gt;Hi everyone, I have a few questions regarding Terraform folder structure and state management for Databricks, and I'd love to get your opinions.&lt;/P&gt;&lt;P&gt;For context, our Databricks environment is already deployed and Unity Catalog is configured. The Terraform code I’m working on is strictly for managing workspace-level resources.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Question 1:&lt;/STRONG&gt; After creating and calling modules for clusters, SQL warehouses, and cluster policies, my main.tf file has become very large. Should I split these into separate, flattened files by resource type (e.g., clusters.tf, secrets.tf, policies.tf)?&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Question 2:&lt;/STRONG&gt; Currently, I am also managing Unity Catalog resources (catalogs, schemas, volumes, external locations, and their respective grants) within this same workspace-level state. As the environment grows, the state file is becoming quite large. I am considering separating the Unity Catalog resources into their own isolated Terraform state. Does this approach make sense?"&lt;/P&gt;</description>
    <pubDate>Wed, 25 Mar 2026 17:57:48 GMT</pubDate>
    <dc:creator>ismaelhenzel</dc:creator>
    <dc:date>2026-03-25T17:57:48Z</dc:date>
    <item>
      <title>Terraform folder structure and states</title>
      <link>https://community.databricks.com/t5/administration-architecture/terraform-folder-structure-and-states/m-p/152063#M5072</link>
      <description>&lt;P&gt;Hi everyone, I have a few questions regarding Terraform folder structure and state management for Databricks, and I'd love to get your opinions.&lt;/P&gt;&lt;P&gt;For context, our Databricks environment is already deployed and Unity Catalog is configured. The Terraform code I’m working on is strictly for managing workspace-level resources.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Question 1:&lt;/STRONG&gt; After creating and calling modules for clusters, SQL warehouses, and cluster policies, my main.tf file has become very large. Should I split these into separate, flattened files by resource type (e.g., clusters.tf, secrets.tf, policies.tf)?&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Question 2:&lt;/STRONG&gt; Currently, I am also managing Unity Catalog resources (catalogs, schemas, volumes, external locations, and their respective grants) within this same workspace-level state. As the environment grows, the state file is becoming quite large. I am considering separating the Unity Catalog resources into their own isolated Terraform state. Does this approach make sense?"&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2026 17:57:48 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/terraform-folder-structure-and-states/m-p/152063#M5072</guid>
      <dc:creator>ismaelhenzel</dc:creator>
      <dc:date>2026-03-25T17:57:48Z</dc:date>
    </item>
    <item>
      <title>Re: Terraform folder structure and states</title>
      <link>https://community.databricks.com/t5/administration-architecture/terraform-folder-structure-and-states/m-p/152080#M5073</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/103370"&gt;@ismaelhenzel&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;In terms of your first question,&amp;nbsp;Terraform automatically loads all *.tf files in the same directory, so it’s common practice to organise them by concern. For example,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="l8rrz21 _1ibi0s3dn" data-ui-element="code-block-container"&gt;
&lt;PRE&gt;&lt;CODE class="markdown-code-text p8i6j0e hljs language-text _12n1b832"&gt;envs/
  prod/
    backend.tf          &lt;SPAN class="hljs-comment"&gt;# remote state config&lt;/SPAN&gt;
    providers.tf        &lt;SPAN class="hljs-comment"&gt;# databricks + cloud providers&lt;/SPAN&gt;
    versions.tf
    &lt;SPAN class="hljs-built_in"&gt;locals&lt;/SPAN&gt;.tf
    clusters.tf         &lt;SPAN class="hljs-comment"&gt;# cluster + pools modules&lt;/SPAN&gt;
    sql_warehouses.tf
    cluster_policies.tf
    secrets.tf&lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV class="l8rrz23 _1ibi0s3d6 _1ibi0s332 _1ibi0s3do _1ibi0s3bm _1ibi0s3ce"&gt;
&lt;DIV class="lqznwq0"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="lqznwq0"&gt;&lt;SPAN&gt;This matches Databricks’ general IaC &lt;A href="https://docs.databricks.com/gcp/en/lakehouse-architecture/deployment-guide/iac#pattern-3-reusable-modules-pattern" target="_self"&gt;guidance&lt;/A&gt; to use modules and clear patterns for "workspace-level configuration" like cluster policies, pools, secrets, etc., while keeping state in a remote backend and using separate states per environment.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;For the other question,&amp;nbsp;it’s reasonable (and often desirable) to move Unity Catalog resources (metastore, catalogs, schemas, external locations, storage credentials, grants) into their own state once things grow. UC is a governance/metastore concern, often owned by a different team and with a different change cadence than compute. In the same link I shared above for your first question, you will see that the guidance explicitly calls&lt;SPAN&gt;&amp;nbsp;out Unity Catalog resources as their own deployment pattern alongside account‑level infrastructure and workspace‑level configuration. You can also see that the&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;official UC Terraform guides &lt;A href="https://docs.databricks.com/aws/en/dev-tools/terraform/automate-uc" target="_self"&gt;article&lt;/A&gt; shows UC as a coherent unit (metastore, external locations, catalogues, schemas, grants) managed via the Databricks provider, which maps nicely to its own state file/project.&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV class="l8rrz21 _1ibi0s3dn" data-ui-element="code-block-container"&gt;
&lt;DIV class="l8rrz23 _1ibi0s3d6 _1ibi0s332 _1ibi0s3do _1ibi0s3bm _1ibi0s3ce"&gt;
&lt;DIV class="lqznwq0"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="lqznwq0"&gt;&lt;SPAN&gt;If you want some concrete end‑to‑end UC + Terraform examples to crib from, the official docs and registry &lt;A href="https://registry.terraform.io/providers/databricks/databricks/latest/docs/guides/unity-catalog" target="_self"&gt;guides&lt;/A&gt; are good starting points.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV class="lqznwq0"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="lqznwq0"&gt;&lt;FONT size="2" color="#FF6600"&gt;&lt;STRONG style="color: #1b3139; font-family: inherit;"&gt;&lt;I&gt;&lt;FONT color="#FF6600"&gt;If this answer resolves your question, could you mark it as “Accept as Solution”? That helps other users quickly find the correct fix.&lt;/FONT&gt;&lt;/I&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 25 Mar 2026 22:29:08 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/terraform-folder-structure-and-states/m-p/152080#M5073</guid>
      <dc:creator>Ashwin_DSA</dc:creator>
      <dc:date>2026-03-25T22:29:08Z</dc:date>
    </item>
    <item>
      <title>Re: Terraform folder structure and states</title>
      <link>https://community.databricks.com/t5/administration-architecture/terraform-folder-structure-and-states/m-p/152221#M5080</link>
      <description>&lt;P&gt;Thanks for your answer, Ashwin! This really clarifies how to better structure the workspace Terraform. I completely agree with your points, and your approach aligns perfectly with what I had in mind. I will split my main.tf into separate files based on the resources being created in the workspace. I'll also separate out the Unity Catalog resources into their own state. As you mentioned, their change cadence is very different, and they grow the state file much more quickly—especially when adopting strategies like domain-oriented catalogs. Thanks again!&lt;/P&gt;</description>
      <pubDate>Thu, 26 Mar 2026 19:46:06 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/terraform-folder-structure-and-states/m-p/152221#M5080</guid>
      <dc:creator>ismaelhenzel</dc:creator>
      <dc:date>2026-03-26T19:46:06Z</dc:date>
    </item>
  </channel>
</rss>

