<?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>article Customizing Target Deployments in Databricks Asset Bundles in Technical Blog</title>
    <link>https://community.databricks.com/t5/technical-blog/customizing-target-deployments-in-databricks-asset-bundles/ba-p/124772</link>
    <description>&lt;P&gt;&lt;LI-TOC indent="15" liststyle="disc" maxheadinglevel="2"&gt;&lt;/LI-TOC&gt;&lt;/P&gt;
&lt;H1&gt;&amp;nbsp;&lt;/H1&gt;
&lt;H1&gt;&lt;SPAN&gt;Introduction&lt;/SPAN&gt;&lt;/H1&gt;
&lt;P&gt;&lt;SPAN&gt;Databricks Asset Bundles (DAB) is a structured way to define, deploy, and manage Databricks workflows, including jobs, clusters, dashboards, model serving endpoints, and other resources, using declarative YAML configurations. It allows us to implement software engineering best practices by enabling version control, CI/CD integration, and automation by treating infrastructure and data assets as code. DAB simplifies collaboration and deployment across environments, ensuring easier management and scalability of Databricks projects.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;EM&gt;If you are completely new to DAB, please refer to &lt;A href="https://docs.databricks.com/aws/en/dev-tools/bundles/" target="_blank" rel="noopener"&gt;What are Databricks Asset Bundles&lt;/A&gt; before continuing with this blog post.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;By using DAB, you can define Databricks resources like jobs, pipelines, and notebooks as source files. These files fully describe a project and the code that governs it, providing project structure and automation for testing and deployment. Additionally, DAB allows us to define deployment targets that can be fully customized depending on the use case and the project’s needs, such as development, staging, and production.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In some cases, specific environments may require additional resources. For example, staging might include extra testing pipelines that are not needed in production once validation is complete.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In this blog post, we will explore different ways of customizing resource deployments per target.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H1&gt;&lt;SPAN&gt;Using &lt;FONT face="andale mono,times"&gt;include&lt;/FONT&gt; and &lt;FONT face="andale mono,times"&gt;resources&lt;/FONT&gt; mapping&lt;/SPAN&gt;&lt;/H1&gt;
&lt;P&gt;&lt;SPAN&gt;As we know, Databricks resources are defined by specifying the type of resource and its configuration under the &lt;/SPAN&gt;&lt;FONT face="andale mono,times"&gt;&lt;SPAN&gt;resources &lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN&gt;mapping in &lt;/SPAN&gt;&lt;FONT face="andale mono,times"&gt;&lt;SPAN&gt;databricks.yml&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN&gt;. Resources can include Databricks apps, clusters, dashboards, jobs, pipelines, model serving endpoints, and more. The following example illustrates how to define a simple job and a job cluster:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;resources:
  jobs:
    hello-job:
      name: hello-job
      max_concurrent_runs: 1
      job_clusters:
        - job_cluster_key: small_cluster
          new_cluster:
            spark_version: 16.4.x-scala2.13
            node_type_id: m5d.large
            num_workers: 1
      tasks:
        - task_key: hello-task
          notebook_task:
            notebook_path: ./hello.py
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;By default, resources can be declared at the top level, making them available across all deployment targets:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;# databricks.yml

bundle:
  name: test-bundle

resources:
  ...

targets:
  dev:
    default: true
    ...
  stg:
    ...
  prd:
    ...&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;With this setup, the same resources are deployed to dev, stg, and prd, ensuring consistency across all environments.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In many cases, different environments require unique configurations. For example, you might need additional testing pipelines in staging but not in production. To achieve this, you can define resources specific to each deployment target:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;# databricks.yml

bundle:
  name: test-bundle

resources:
  ...

targets:
  dev:
    default: true
    resources:
      ...
    ...
  stg:
    resources:
      ...
    ...
  prd:
    resources:
      ...
    ...&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;By defining resources at the target level, additional resources are deployed only where needed, while still inheriting the global resources from the top level. This flexible approach ensures that each environment is optimized for its purpose without unnecessary configurations.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Be aware that each resource has an &lt;/SPAN&gt;&lt;STRONG&gt;identifier&lt;/STRONG&gt;&lt;SPAN&gt;. If you use the same identifier at both the top level and the target level, the target-level definition will take precedence and override the top-level definition.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;EM&gt;For detailed guidance on customizing configurations for specific targets, refer to the &lt;A href="https://docs.databricks.com/aws/en/dev-tools/bundles/cluster-override" target="_blank" rel="noopener"&gt;Override cluster settings&lt;/A&gt; section in the Databricks Asset Bundles documentation. Additionally, explore a &lt;A href="https://github.com/alexott/dabs-playground/tree/main/integration-tests" target="_blank" rel="noopener"&gt;sample code&lt;/A&gt; that illustrates how to configure integration tests by redefining resources for each target environment.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;So far, everything has been defined in a single YAML file, which can make readability and management challenging as the project grows. Let’s explore some strategies to enhance flexibility, support customizations, and ensure seamless scalability as the project expands.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The &lt;/SPAN&gt;&lt;FONT face="andale mono,times"&gt;&lt;SPAN&gt;include&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN&gt; mapping allows us to add a list of path globs containing configuration files to include within the bundle. These path globs are relative to the location of the bundle configuration file in which the path globs are specified.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Therefore, we can structure the project in the following form:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;project/
├── tests/
│   └── ...
├── resources/
│   ├── pipelines.yml
│   ├── jobs.yml
│   └── dashboards.yml
├── src/
│   ├── notebook_a.ipynb
│   ├── notebook_b.ipynb
│   └── ...
├── databricks.yml
└── ...&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;And instead of using resources in a single YAML, we just specify what we want to include:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;# databricks.yml

bundle:
  name: test-bundle

include:
  - resources/*.yml

targets:
  dev:
    default: true
    ...
  stg:
    ...
  prd:
    ...&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;Each file in &lt;/SPAN&gt;&lt;FONT face="andale mono,times"&gt;&lt;SPAN&gt;resources/*.yml&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN&gt; contains its own resource definition, allowing for a structured and modular approach to managing YAML files. This separation keeps resource definitions organized and easy to manage as the project scales. However, the &lt;/SPAN&gt;&lt;FONT face="andale mono,times"&gt;&lt;SPAN&gt;include&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN&gt; mapping can only be used at the top level, meaning all included resources will be deployed to every target.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;EM&gt;The important fact to note here is that the include mapping reads all the files, combining the resource definitions and merging them per target, allowing overrides as mentioned above.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If we need to add resources for a specific target, we must define resources at the target level, as shown in the previous example. While this approach works, it can become cumbersome when managing numerous customizations across multiple targets. To address this challenge, let’s explore a better way of structuring target-specific YAML files in the next section.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H1&gt;&lt;SPAN&gt;Separating Target YAMLs&lt;/SPAN&gt;&lt;/H1&gt;
&lt;P&gt;&lt;SPAN&gt;A key advantage of DAB is that the &lt;/SPAN&gt;&lt;FONT face="andale mono,times"&gt;&lt;SPAN&gt;include&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN&gt; directive is not limited to resources - it can also be used for other top-level keys like &lt;/SPAN&gt;&lt;FONT face="andale mono,times"&gt;&lt;SPAN&gt;targets &lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN&gt;mapping. This allows for a more modular and scalable project structure.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;To improve organization and maintainability, we can structure our project as follows:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;project/
├── tests/
│   └── ...
├── resources/
│   ├── pipelines.yml
│   ├── jobs.yml
│   └── dashboards.yml
├── src/
│   ├── notebook_a.ipynb
│   ├── notebook_b.ipynb
│   └── ...
├── targets/
│   ├── dev.yml
│   ├── stg.yml
│   └── prd.yml
├── databricks.yml
└── ...
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;In this setup:&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;The &lt;/SPAN&gt;&lt;FONT face="andale mono,times"&gt;&lt;SPAN&gt;resources/&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN&gt; directory contains shared resources used by all environments.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;The &lt;/SPAN&gt;&lt;FONT face="andale mono,times"&gt;&lt;SPAN&gt;targets/&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN&gt; directory holds YAML files that define the specific resources for each deployment target.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN&gt;Each target file, such as &lt;/SPAN&gt;&lt;FONT face="andale mono,times"&gt;&lt;SPAN&gt;targets/dev.yml&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN&gt;, includes only the resources specific to that environment.&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;# targets/dev.yml

targets:
  dev:
    default: true
    resources:
      ...
    ...&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;Similarly, &lt;/SPAN&gt;&lt;FONT face="andale mono,times"&gt;&lt;SPAN&gt;targets/stg.yml&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN&gt; and &lt;/SPAN&gt;&lt;FONT face="andale mono,times"&gt;&lt;SPAN&gt;targets/prd.yml&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN&gt; will include the appropriate resources for their respective environments.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In &lt;/SPAN&gt;&lt;FONT face="andale mono,times"&gt;&lt;SPAN&gt;databricks.yml&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN&gt;, we can now include the common resources while allowing each target to bring its own specific configurations:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;# databricks.yml

bundle:
  name: test-bundle

include:
  - resources/*.yml
  - targets/*.yml&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;This setup provides a structured and scalable way to manage resources, ensuring that each environment gets precisely the resources it needs without unnecessary duplication. By splitting resource definitions across separate YAML files for each target, project teams gain better organization, control, and flexibility.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This modular approach simplifies configuration management, making it easier to track changes, customize deployments, and avoid bloated YAML files.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H1&gt;&lt;SPAN&gt;Splitting Resources&lt;/SPAN&gt;&lt;/H1&gt;
&lt;P&gt;&lt;SPAN&gt;The previous examples grouped multiple resources into shared YAML files. Another approach is to define resources individually and associate them directly with their target environments. This creates a clean, intuitive structure where each resource lives next to the target it’s meant for.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Example project layout:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;project/
├── tests/
│   └── ...
├── resources/
│   ├── pipeline_a.yml
│   ├── pipeline_b.yml
│   └── ...
├── src/
│   ├── notebook_a.ipynb
│   ├── notebook_b.ipynb
│   └── ...
├── databricks.yml
└── ...&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;In this setup, &lt;/SPAN&gt;&lt;FONT face="andale mono,times"&gt;&lt;SPAN&gt;databricks.yml&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN&gt; includes all resource files:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;# databricks.yml

bundle:
  name: test-bundle

include:
  - resources/*.yml

targets:
  dev:
    ...
  stg:
    ...
  prd:
    ...&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;Each resource file defines a &lt;/SPAN&gt;&lt;FONT face="andale mono,times"&gt;&lt;SPAN&gt;resources&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN&gt; mapping alongside the target(s) it’s intended for. For example:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;# pipeline_a.yml

anchor_name: &amp;amp;anchor_name
  resources:
    ...

targets:
  dev:
    &amp;lt;&amp;lt;: *anchor_name
&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;# pipeline_b.yml

anchor_name: &amp;amp;anchor_name
  resources:
    ...

targets:
  dev:
    &amp;lt;&amp;lt;: *anchor_name
  stg:
    &amp;lt;&amp;lt;: *anchor_name&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;Here we are leveraging &lt;/SPAN&gt;&lt;A href="https://support.atlassian.com/bitbucket-cloud/docs/yaml-anchors/" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;YAML anchors&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt; to keep the resource definition DRY and easy to read. YAML anchors are a feature that allows you to define reusable blocks of configuration, which can then be referenced elsewhere in your YAML file to avoid repetition.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The &lt;/SPAN&gt;&lt;FONT face="andale mono,times"&gt;&lt;SPAN&gt;pipeline_a.yml&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN&gt; will only deploy its defined resources to the &lt;/SPAN&gt;&lt;SPAN&gt;dev&lt;/SPAN&gt;&lt;SPAN&gt; environment, while the &lt;/SPAN&gt;&lt;SPAN&gt;pipeline_b.yml&lt;/SPAN&gt;&lt;SPAN&gt; will deploy to both the &lt;/SPAN&gt;&lt;SPAN&gt;dev&lt;/SPAN&gt;&lt;SPAN&gt; and &lt;/SPAN&gt;&lt;SPAN&gt;stg&lt;/SPAN&gt;&lt;SPAN&gt; environments. The main &lt;/SPAN&gt;&lt;FONT face="andale mono,times"&gt;databricks.yml&lt;/FONT&gt;&lt;SPAN&gt; defines the targets, and the included YAML file extends the corresponding section.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can freely mix this approach with the previously described structures. Functionally, they achieve the same result. The choice depends on your preferences and the level of modularity you need. This method is especially powerful when you have many environment-specific resources and want to avoid cluttering large files with multiple unrelated configurations.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;EM&gt;Explore the following &lt;A href="https://github.com/alexott/dabs-playground/tree/main/mlops-statcks-multiphase" target="_blank" rel="noopener"&gt;code example&lt;/A&gt; to see how this approach enables the implementation of a comprehensive MLOps project, from training and validation to deployment, using a multiphase workflow with customized resources tailored for each stage.&lt;/EM&gt;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;H1&gt;Runtime Editing&lt;/H1&gt;
&lt;P&gt;&lt;SPAN&gt;DAB supports &lt;/SPAN&gt;&lt;A href="https://docs.databricks.com/aws/en/dev-tools/bundles/variables" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;substitutions and custom variables&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;, enabling modular, reusable, and dynamic configuration files. These features allow values to be retrieved at runtime, ensuring that resource configurations can be adjusted dynamically when deploying and running a bundle.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Variables can be assigned different values for each target, and by leveraging default values, you can implement conditional overrides for specific resource settings as needed. Please refer to the following &lt;/SPAN&gt;&lt;A href="https://github.com/alexott/dabs-playground/tree/main/vars_demo" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;example code&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt; to see how this logic can be implemented.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Unfortunately, DAB does not currently support using variables to dynamically set &lt;/SPAN&gt;&lt;FONT face="andale mono,times"&gt;&lt;SPAN&gt;include&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN&gt; directives. As a workaround, we can modify the &lt;/SPAN&gt;&lt;FONT face="andale mono,times"&gt;databricks.yml&lt;/FONT&gt;&lt;SPAN&gt; file within a CI/CD pipeline by substituting variables before executing the &lt;/SPAN&gt;&lt;FONT face="andale mono,times"&gt;&lt;SPAN&gt;databricks bundle deploy &lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN&gt;command. This approach allows for greater flexibility in managing environment-specific configurations while maintaining automation in the deployment process.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;We can enhance our project structure by leveraging environment variables to dynamically set configurations for each target, making deployments even more flexible:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;project/
├── tests/
│   └── ...
├── resources/
|   ├── common/
│   |   ├── pipelines.yml
│   |   ├── jobs.yml
│   |   └── dashboards.yml
|   ├── dev/
│   |   └── ...
|   ├── stg/
│   |   └── ...
|   ├── prd/
│   |   └── ...
├── src/
│   ├── notebook_a.ipynb
│   ├── notebook_b.ipynb
│   └── ...
├── targets/
│   ├── dev.yml
│   ├── stg.yml
│   └── prd.yml
├── databricks.yml
└── ...&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;Where &lt;FONT face="andale mono,times"&gt;databricks.yml&lt;/FONT&gt; looks like:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;# databricks.yml

bundle:
  name: test-bundle

include:
  - resources/common/*.yml
  - resources/${target}/*/yml
  - targets/*.yml&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;In a CI/CD pipeline, we typically pull the DAB code from a Git repository and set an environment variable that represents the target deployment environment. Before running the &lt;/SPAN&gt;&lt;FONT face="andale mono,times"&gt;&lt;SPAN&gt;databricks bundle deploy &lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN&gt;command, we can dynamically replace &lt;/SPAN&gt;&lt;FONT face="andale mono,times"&gt;&lt;SPAN&gt;${target}&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN&gt; with the appropriate environment variable using a simple command like &lt;/SPAN&gt;&lt;FONT face="andale mono,times"&gt;&lt;SPAN&gt;sed&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;sed -i -e 's/${target}/'"$TARGET"'/g' databricks.yml&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;When running this command, every instance of &lt;/SPAN&gt;&lt;FONT face="andale mono,times"&gt;&lt;SPAN&gt;${target}&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN&gt; in the &lt;/SPAN&gt;&lt;FONT face="andale mono,times"&gt;&lt;SPAN&gt;databricks.yml&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN&gt; file is replaced with the value of the &lt;/SPAN&gt;&lt;FONT face="andale mono,times"&gt;&lt;SPAN&gt;$TARGET&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN&gt; environment variable. This ensures that the Databricks bundle only loads the configuration and resources specific to the intended deployment environment.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;By leveraging this approach, we achieve greater flexibility, allowing each deployment to dynamically include the correct resources based on the target environment.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H1&gt;&lt;SPAN&gt;Conclusion&lt;/SPAN&gt;&lt;/H1&gt;
&lt;P&gt;&lt;SPAN&gt;Scaling DAB projects and customizing deployments for multiple targets while maintaining a modular, manageable structure can be a challenge. However, with the right approach, you can streamline your workflow and reduce overhead as your projects grow.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In this article, we explored several practical techniques to help you manage increasing complexity and customization needs.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;To recap:&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;&lt;STRONG&gt;Use include and resource mapping&lt;/STRONG&gt; - Instead of putting everything into a single &lt;/SPAN&gt;&lt;SPAN&gt;databricks.yml&lt;/SPAN&gt;&lt;SPAN&gt;, spread out resources into separate YAML files and use &lt;/SPAN&gt;&lt;SPAN&gt;include&lt;/SPAN&gt;&lt;SPAN&gt; mapping to assemble them. This improves clarity and scalability.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;SPAN&gt;&lt;STRONG&gt;Separating Target YAMLs&lt;/STRONG&gt; - For environment-specific customization, maintain distinct YAML files for each target. This keeps configurations clean and easy to manage.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;STRONG&gt;Splitting Resources&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;- Define each resource individually and associate them directly to their target environments in the same YAML. This modular approach makes updates and troubleshooting much simpler.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="font-weight: 400;" aria-level="1"&gt;&lt;STRONG&gt;Runtime Editing&lt;/STRONG&gt;&amp;nbsp;&lt;SPAN&gt;- Utilize CI/CD pipelines and environment variables to dynamically adjust resource targets at deployment time, enabling flexible and automated workflows.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN&gt;I hope these approaches and examples have provided you with a clearer understanding of how to structure your Databricks project using DAB. By implementing these strategies, you can achieve greater target customization while ensuring your deployment remains scalable, modular, and easy to manage.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Happy coding!&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 21 Jul 2025 08:51:01 GMT</pubDate>
    <dc:creator>Vladsiv</dc:creator>
    <dc:date>2025-07-21T08:51:01Z</dc:date>
    <item>
      <title>Customizing Target Deployments in Databricks Asset Bundles</title>
      <link>https://community.databricks.com/t5/technical-blog/customizing-target-deployments-in-databricks-asset-bundles/ba-p/124772</link>
      <description>&lt;DIV class="border-borderMain/50 ring-borderMain/50 divide-borderMain/50 dark:divide-borderMainDark/50 dark:ring-borderMainDark/50 dark:border-borderMainDark/50 bg-transparent"&gt;
&lt;DIV class="gap-y-sm md:gap-y-md flex flex-col"&gt;
&lt;DIV class="relative font-sans text-base text-textMain dark:text-textMainDark selection:bg-super/50 selection:text-textMain dark:selection:bg-super/10 dark:selection:text-super"&gt;
&lt;DIV class="min-w-0 break-words [word-break:break-word]"&gt;
&lt;DIV id="markdown-content-0" class="gap-y-md after:clear-both after:block after:content-['']" dir="auto"&gt;
&lt;DIV class="relative"&gt;
&lt;DIV class="prose text-pretty dark:prose-invert inline leading-normal break-words min-w-0 [word-break:break-word]"&gt;
&lt;P class="my-0"&gt;Discover how Databricks Asset Bundles (DAB) empowers teams to define, automate, and manage Databricks resources with ease using YAML-based configurations while at the same time enabling environment-specific customization, streamlining deployment and collaboration across multiple environments, from development to production.&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 21 Jul 2025 08:51:01 GMT</pubDate>
      <guid>https://community.databricks.com/t5/technical-blog/customizing-target-deployments-in-databricks-asset-bundles/ba-p/124772</guid>
      <dc:creator>Vladsiv</dc:creator>
      <dc:date>2025-07-21T08:51:01Z</dc:date>
    </item>
    <item>
      <title>Re: Customizing Target Deployments in Databricks Asset Bundles</title>
      <link>https://community.databricks.com/t5/technical-blog/customizing-target-deployments-in-databricks-asset-bundles/bc-p/125298#M693</link>
      <description>&lt;P&gt;Thanks for the blog! DABs are really a great tool to enhance the developer experience with Databricks.&lt;/P&gt;&lt;P&gt;I personally create a bunch of custom variables in my bundle and usually there are some that I won't change at run time, for example catalog, schema and others. These I'll keep in each target definition.&lt;/P&gt;&lt;P&gt;Then using Azure DevOps libraries (one per target environment) in which I can save safely authentication stuff (host, client_id, client_secret). These then I manage with Azure DevOps stages.&lt;/P&gt;&lt;P&gt;Finally, I have very few variables I want to modify when I use "databricks deploy" so I use variable override such:&lt;/P&gt;&lt;PRE&gt;databricks bundle validate --var="your_variable=new-value"&lt;/PRE&gt;&lt;P&gt;For example, I pass &lt;STRONG&gt;git_sha&lt;/STRONG&gt; and &lt;STRONG&gt;git_branch&lt;/STRONG&gt; for traceability which could be used as a tag for a job or a parameter in your package entrypoint.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jul 2025 12:36:37 GMT</pubDate>
      <guid>https://community.databricks.com/t5/technical-blog/customizing-target-deployments-in-databricks-asset-bundles/bc-p/125298#M693</guid>
      <dc:creator>FedeRaimondi</dc:creator>
      <dc:date>2025-07-15T12:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: Customizing Target Deployments in Databricks Asset Bundles</title>
      <link>https://community.databricks.com/t5/technical-blog/customizing-target-deployments-in-databricks-asset-bundles/bc-p/131428#M757</link>
      <description>&lt;P&gt;Hi, great post!&lt;/P&gt;&lt;P&gt;I am trying to dynamically change in the targets section the variables defined in the databricks.yml file. Eg:&lt;/P&gt;&lt;PRE&gt;&lt;BR /&gt;# databricks.yml&lt;BR /&gt;variables:&lt;BR /&gt;  catalog: &lt;BR /&gt;    description: The Unity Catalog catalog to use.&lt;BR /&gt;    default: my_catalog&lt;BR /&gt;  schema:&lt;BR /&gt;    description: The Unity Catalog schema basename to use as a prefix for all created schemas. bundle.target will be appended to this value.&lt;BR /&gt;    default: my_schema&lt;BR /&gt;  landing_data_volume:&lt;BR /&gt;    description: The volume to use for landing data.&lt;BR /&gt;    default: /Volumes/my_catalog/my_schema/landing_data&lt;/PRE&gt;&lt;P&gt;my ultimate goal is to use these variables in the targets section, in order to append a suffix such as "dev" to the schema to be deployed in the dev environment. However, a syntax like this:&lt;/P&gt;&lt;PRE&gt;# databricks.yml&lt;/PRE&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;targets&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;  dev&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;    mode&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;development&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;    variables&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;      catalog&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;${workspace.current_user.short_name}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;      schema&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;${var.schema}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;    default&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;true&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;    workspace&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;      host&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;&lt;A href="https://my_host.cloud.databricks.com" target="_blank"&gt;https://my_host.cloud.databricks.com&lt;/A&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;results in the following error:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;PRE&gt;Error: cycle detected in field resolution: variables.schema.default -&amp;gt; var.schema -&amp;gt; var.schema&lt;/PRE&gt;&lt;P&gt;which way would you recommend to sort this out?&lt;/P&gt;&lt;P&gt;Many thanks,&lt;/P&gt;&lt;P&gt;Domenico&lt;/P&gt;</description>
      <pubDate>Tue, 09 Sep 2025 16:04:57 GMT</pubDate>
      <guid>https://community.databricks.com/t5/technical-blog/customizing-target-deployments-in-databricks-asset-bundles/bc-p/131428#M757</guid>
      <dc:creator>dsimone</dc:creator>
      <dc:date>2025-09-09T16:04:57Z</dc:date>
    </item>
    <item>
      <title>Re: Customizing Target Deployments in Databricks Asset Bundles</title>
      <link>https://community.databricks.com/t5/technical-blog/customizing-target-deployments-in-databricks-asset-bundles/bc-p/143011#M872</link>
      <description>&lt;P&gt;Databricks added the ability to parameterize the catalog and schema for Dashboards, I tested it and wrote detailed examples -&amp;nbsp;&lt;A href="https://medium.com/@protmaks/dynamic-catalog-schema-in-databricks-dashboards-b7eea62270c6" target="_self"&gt;https://medium.com/@protmaks/dynamic-catalog-schema-in-databricks-dashboards-b7eea62270c6&lt;/A&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 05 Jan 2026 10:57:34 GMT</pubDate>
      <guid>https://community.databricks.com/t5/technical-blog/customizing-target-deployments-in-databricks-asset-bundles/bc-p/143011#M872</guid>
      <dc:creator>protmaks</dc:creator>
      <dc:date>2026-01-05T10:57:34Z</dc:date>
    </item>
  </channel>
</rss>

