<?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 Service Principal Authentication / Terraform in Administration &amp; Architecture</title>
    <link>https://community.databricks.com/t5/administration-architecture/service-principal-authentication-terraform/m-p/116493#M3281</link>
    <description>&lt;P&gt;Hello Databricks Community,&lt;/P&gt;&lt;P&gt;I'm encountering an issue when trying to apply my Terraform configuration to create a Databricks MWS network on GCP. The terraform apply command fails with the following error:&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;PRE&gt;Error: cannot create mws networks: failed during request visitor: &lt;SPAN class=""&gt;default auth: cannot configure default credentials, please check https://docs.databricks.com/en/dev-tools/auth.html#databricks-client-unified-authentication to configure credentials for your preferred authentication method.&lt;/SPAN&gt; Config: host=https://accounts.gcp.databricks.com, account_id=&amp;lt;accountid&amp;gt;, client_id=&amp;lt;clientid&amp;gt;, client_secret=***

  with databricks_mws_networks.databricks_network["dbx-workspace"],
  on main.tf line 1, in resource "databricks_mws_networks" "databricks_network":
   1: resource "databricks_mws_networks" "databricks_network" {&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;For context, the service principal I'm attempting to use for this Terraform deployment was &lt;STRONG&gt;created directly through the Databricks Account Console UI&lt;/STRONG&gt;. I have the client_id (Application ID) of this service principal. The client id and the client secret generated are saved in gcp secret manager&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Here is my versions.tf file:&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;PRE&gt;terraform {
  required_providers {
    google = {
      source  = "hashicorp/google"
      version = "~&amp;gt; 6.0"
    }
    google-beta = {
      source  = "hashicorp/google-beta"
      version = "~&amp;gt; 6.0"
    }
    databricks = {
      source  = "databricks/databricks"
      version = "~&amp;gt; 1.74.0"
    }
  }
  required_version = "&amp;gt;= 1.6.3"

}&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;Here is the provider.tf file&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;PRE&gt;provider "databricks" {
  alias                  = "account"
  host                   = "https://accounts.gcp.databricks.com"
  account_id             = var.databricks_account_id
  client_id = data.google_secret_manager_secret_version.databricks_client_id.secret_data&lt;BR /&gt;  client_secret = data.google_secret_manager_secret_version.databricks_client_secret.secret_data&lt;BR /&gt;  auth_type = "google-id"&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 24 Apr 2025 15:40:53 GMT</pubDate>
    <dc:creator>naumanmunir</dc:creator>
    <dc:date>2025-04-24T15:40:53Z</dc:date>
    <item>
      <title>Service Principal Authentication / Terraform</title>
      <link>https://community.databricks.com/t5/administration-architecture/service-principal-authentication-terraform/m-p/116493#M3281</link>
      <description>&lt;P&gt;Hello Databricks Community,&lt;/P&gt;&lt;P&gt;I'm encountering an issue when trying to apply my Terraform configuration to create a Databricks MWS network on GCP. The terraform apply command fails with the following error:&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;PRE&gt;Error: cannot create mws networks: failed during request visitor: &lt;SPAN class=""&gt;default auth: cannot configure default credentials, please check https://docs.databricks.com/en/dev-tools/auth.html#databricks-client-unified-authentication to configure credentials for your preferred authentication method.&lt;/SPAN&gt; Config: host=https://accounts.gcp.databricks.com, account_id=&amp;lt;accountid&amp;gt;, client_id=&amp;lt;clientid&amp;gt;, client_secret=***

  with databricks_mws_networks.databricks_network["dbx-workspace"],
  on main.tf line 1, in resource "databricks_mws_networks" "databricks_network":
   1: resource "databricks_mws_networks" "databricks_network" {&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;For context, the service principal I'm attempting to use for this Terraform deployment was &lt;STRONG&gt;created directly through the Databricks Account Console UI&lt;/STRONG&gt;. I have the client_id (Application ID) of this service principal. The client id and the client secret generated are saved in gcp secret manager&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Here is my versions.tf file:&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;PRE&gt;terraform {
  required_providers {
    google = {
      source  = "hashicorp/google"
      version = "~&amp;gt; 6.0"
    }
    google-beta = {
      source  = "hashicorp/google-beta"
      version = "~&amp;gt; 6.0"
    }
    databricks = {
      source  = "databricks/databricks"
      version = "~&amp;gt; 1.74.0"
    }
  }
  required_version = "&amp;gt;= 1.6.3"

}&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;Here is the provider.tf file&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;PRE&gt;provider "databricks" {
  alias                  = "account"
  host                   = "https://accounts.gcp.databricks.com"
  account_id             = var.databricks_account_id
  client_id = data.google_secret_manager_secret_version.databricks_client_id.secret_data&lt;BR /&gt;  client_secret = data.google_secret_manager_secret_version.databricks_client_secret.secret_data&lt;BR /&gt;  auth_type = "google-id"&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Apr 2025 15:40:53 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/service-principal-authentication-terraform/m-p/116493#M3281</guid>
      <dc:creator>naumanmunir</dc:creator>
      <dc:date>2025-04-24T15:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: Service Principal Authentication / Terraform</title>
      <link>https://community.databricks.com/t5/administration-architecture/service-principal-authentication-terraform/m-p/116503#M3283</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Databricks account-level APIs can only be called by account owners and account admins and can only be authenticated using Google-issued OIDC tokens.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;EM&gt;In Terraform 0.13 and later&lt;/EM&gt;, data resources have the same dependency resolution behavior&amp;nbsp;&lt;A href="https://www.terraform.io/docs/language/resources/behavior.html#resource-dependencies" target="_blank" rel="nofollow noopener"&gt;as defined for managed resources&lt;/A&gt;. Most data resources make an API call to a workspace. If a workspace doesn't exist yet,&amp;nbsp;default auth: cannot configure default credentials&amp;nbsp;error is raised. To work around this issue and guarantee proper lazy authentication with data resources, you should add&amp;nbsp;depends_on = [databricks_mws_workspaces.this]&amp;nbsp;to the body. This issue doesn't occur if a workspace is created&amp;nbsp;&lt;EM&gt;in one module&lt;/EM&gt;&amp;nbsp;and resources&amp;nbsp;&lt;A href="https://github.com/databricks/terraform-provider-databricks/blob/main/docs/guides/workspace-management.md" target="_blank" rel="noopener"&gt;within the workspace&lt;/A&gt;&amp;nbsp;are created&amp;nbsp;&lt;EM&gt;in another&lt;/EM&gt;.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Please refer to this URL for more information:&lt;BR /&gt;&lt;A href="https://github.com/databricks/terraform-provider-databricks/blob/main/docs/guides/gcp-workspace.md" target="_self"&gt;https://github.com/databricks/terraform-provider-databricks/blob/main/docs/guides/gcp-workspace.md&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Apr 2025 17:29:48 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/service-principal-authentication-terraform/m-p/116503#M3283</guid>
      <dc:creator>mnorland</dc:creator>
      <dc:date>2025-04-24T17:29:48Z</dc:date>
    </item>
  </channel>
</rss>

