<?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 Re: Injecting Databricks secrets into Databricks Asset Bundles. in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/injecting-databricks-secrets-into-databricks-asset-bundles/m-p/134098#M50018</link>
    <description>&lt;P&gt;Hey &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/149877"&gt;@daan_dw&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Possible reason for your problem:&lt;/P&gt;&lt;P&gt;Databricks Asset Bundles use Terraform under the hood, and Terraform cannot resolve Databricks secret references (like ${secrets.aws_secrets.cluster_profile_arn})&lt;BR /&gt;at deployment time. Secrets are only accessible at runtime within notebooks and jobs, not during the bundle deployment phase when Terraform is provisioning&lt;BR /&gt;resources. This is why you get the "undeclared resource" error - Terraform expects all configuration values to be resolved before creating resources.&lt;/P&gt;&lt;P&gt;Possible Solutions:&lt;/P&gt;&lt;P&gt;Use Bundle Variables with Environment Variables: Define your secret as a variable in databricks.yml and inject it using the BUNDLE_VAR_ prefix during deployment.&lt;BR /&gt;Reference it with ${var.variable_name} in your configuration.&lt;/P&gt;&lt;P&gt;CI/CD Platform Secrets (Recommended): Store secrets in your CI/CD platform (GitHub Secrets, Azure DevOps Variables, etc.) and inject them during automated&lt;BR /&gt;deployments using environment variables. This keeps secrets secure and outside version control.&lt;/P&gt;&lt;P&gt;Target-Specific Configuration: For non-sensitive values or different environments, define values directly in target sections of your bundle configuration for dev,&lt;BR /&gt;staging, and prod environments.&lt;/P&gt;&lt;P&gt;Variable Override Files: Create a local .databricks/bundle/variables.json file (added to .gitignore) for development purposes.&lt;/P&gt;&lt;P&gt;The key is to never reference Databricks secrets directly in bundle configuration and instead use bundle variables that are populated externally at deployment time.&lt;/P&gt;</description>
    <pubDate>Tue, 07 Oct 2025 16:46:58 GMT</pubDate>
    <dc:creator>HariSankar</dc:creator>
    <dc:date>2025-10-07T16:46:58Z</dc:date>
    <item>
      <title>Injecting Databricks secrets into Databricks Asset Bundles.</title>
      <link>https://community.databricks.com/t5/data-engineering/injecting-databricks-secrets-into-databricks-asset-bundles/m-p/134094#M50017</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;I want to inject Databricks secrets into my Databricks Asset Bundles in order to avoid exposing secrets.&lt;BR /&gt;I tried it as shown in the code block below but it gives the error below the code block.&lt;BR /&gt;When I hardcode my instance_profile_arn it does work.&lt;BR /&gt;How can I inject My Databricks secrets in my Databricks Asset Bundle?&lt;BR /&gt;Many thanks!&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;instance_profile_arn: ${secrets.aws_secrets.cluster_profile_arn}&lt;/LI-CODE&gt;&lt;P&gt;Error: exit status 1&lt;/P&gt;&lt;P&gt;Error: Reference to undeclared resource&lt;/P&gt;&lt;P&gt;on bundle.tf.json line 42, in resource.databricks_job.running_prd_xml_files_sftp.job_cluster[0].new_cluster.aws_attributes:&lt;BR /&gt;42: "instance_profile_arn": "${secrets.aws_secrets.cluster_profile_arn}",&lt;/P&gt;&lt;P&gt;A managed resource "secrets" "aws_secrets" has not been declared in the root&lt;BR /&gt;module.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Oct 2025 15:55:46 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/injecting-databricks-secrets-into-databricks-asset-bundles/m-p/134094#M50017</guid>
      <dc:creator>daan_dw</dc:creator>
      <dc:date>2025-10-07T15:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: Injecting Databricks secrets into Databricks Asset Bundles.</title>
      <link>https://community.databricks.com/t5/data-engineering/injecting-databricks-secrets-into-databricks-asset-bundles/m-p/134098#M50018</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/149877"&gt;@daan_dw&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Possible reason for your problem:&lt;/P&gt;&lt;P&gt;Databricks Asset Bundles use Terraform under the hood, and Terraform cannot resolve Databricks secret references (like ${secrets.aws_secrets.cluster_profile_arn})&lt;BR /&gt;at deployment time. Secrets are only accessible at runtime within notebooks and jobs, not during the bundle deployment phase when Terraform is provisioning&lt;BR /&gt;resources. This is why you get the "undeclared resource" error - Terraform expects all configuration values to be resolved before creating resources.&lt;/P&gt;&lt;P&gt;Possible Solutions:&lt;/P&gt;&lt;P&gt;Use Bundle Variables with Environment Variables: Define your secret as a variable in databricks.yml and inject it using the BUNDLE_VAR_ prefix during deployment.&lt;BR /&gt;Reference it with ${var.variable_name} in your configuration.&lt;/P&gt;&lt;P&gt;CI/CD Platform Secrets (Recommended): Store secrets in your CI/CD platform (GitHub Secrets, Azure DevOps Variables, etc.) and inject them during automated&lt;BR /&gt;deployments using environment variables. This keeps secrets secure and outside version control.&lt;/P&gt;&lt;P&gt;Target-Specific Configuration: For non-sensitive values or different environments, define values directly in target sections of your bundle configuration for dev,&lt;BR /&gt;staging, and prod environments.&lt;/P&gt;&lt;P&gt;Variable Override Files: Create a local .databricks/bundle/variables.json file (added to .gitignore) for development purposes.&lt;/P&gt;&lt;P&gt;The key is to never reference Databricks secrets directly in bundle configuration and instead use bundle variables that are populated externally at deployment time.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Oct 2025 16:46:58 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/injecting-databricks-secrets-into-databricks-asset-bundles/m-p/134098#M50018</guid>
      <dc:creator>HariSankar</dc:creator>
      <dc:date>2025-10-07T16:46:58Z</dc:date>
    </item>
  </channel>
</rss>

