<?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 Unable to create databricks group and add permission via terraform in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/unable-to-create-databricks-group-and-add-permission-via/m-p/123605#M47036</link>
    <description>&lt;P&gt;I have the following terraform code to create a databricks group and add permission to a workflow:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;resource "databricks_group" "dbx_group" {
  display_name = "ENV_MONITORING_TEAM"
}

resource "databricks_permissions" "workflow_permission" {
  job_id = databricks_job.workflow.id
  access_control {
    group_name       = databricks_group.dbx_group.display_name
    permission_level = "CAN_MANAGE_RUN"
  }
}&lt;/LI-CODE&gt;&lt;P&gt;I have the following databricks terraform provider:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;provider "databricks" {
  alias                  = "workspace"
  host                   = local.dbx_host
  google_service_account = local.gcp_sa
}&lt;/LI-CODE&gt;&lt;P&gt;Now, when I execute 'terraform plan', it returned error:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Error: cannot create group: failed during request visitor: 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;/LI-CODE&gt;&lt;P&gt;If I use the 'host' &amp;amp; the generated 'token' values in '.databrickscfg' file, then 'terraform plan' and 'terraform apply' worked, but I have to use the 'google_service_account' directly to execute the group creation code.&lt;BR /&gt;&lt;BR /&gt;Please suggest what needs to be done here in the existing provider so that the group and permission can be created via terraform.&lt;/P&gt;</description>
    <pubDate>Wed, 02 Jul 2025 08:19:59 GMT</pubDate>
    <dc:creator>soumiknow</dc:creator>
    <dc:date>2025-07-02T08:19:59Z</dc:date>
    <item>
      <title>Unable to create databricks group and add permission via terraform</title>
      <link>https://community.databricks.com/t5/data-engineering/unable-to-create-databricks-group-and-add-permission-via/m-p/123605#M47036</link>
      <description>&lt;P&gt;I have the following terraform code to create a databricks group and add permission to a workflow:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;resource "databricks_group" "dbx_group" {
  display_name = "ENV_MONITORING_TEAM"
}

resource "databricks_permissions" "workflow_permission" {
  job_id = databricks_job.workflow.id
  access_control {
    group_name       = databricks_group.dbx_group.display_name
    permission_level = "CAN_MANAGE_RUN"
  }
}&lt;/LI-CODE&gt;&lt;P&gt;I have the following databricks terraform provider:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;provider "databricks" {
  alias                  = "workspace"
  host                   = local.dbx_host
  google_service_account = local.gcp_sa
}&lt;/LI-CODE&gt;&lt;P&gt;Now, when I execute 'terraform plan', it returned error:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Error: cannot create group: failed during request visitor: 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;/LI-CODE&gt;&lt;P&gt;If I use the 'host' &amp;amp; the generated 'token' values in '.databrickscfg' file, then 'terraform plan' and 'terraform apply' worked, but I have to use the 'google_service_account' directly to execute the group creation code.&lt;BR /&gt;&lt;BR /&gt;Please suggest what needs to be done here in the existing provider so that the group and permission can be created via terraform.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jul 2025 08:19:59 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/unable-to-create-databricks-group-and-add-permission-via/m-p/123605#M47036</guid>
      <dc:creator>soumiknow</dc:creator>
      <dc:date>2025-07-02T08:19:59Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to create databricks group and add permission via terraform</title>
      <link>https://community.databricks.com/t5/data-engineering/unable-to-create-databricks-group-and-add-permission-via/m-p/135447#M50352</link>
      <description>&lt;P&gt;Greetings&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/117977"&gt;@soumiknow&lt;/a&gt;&amp;nbsp;, I did some digging internally and found something that may help:&lt;/P&gt;
&lt;P&gt;Based on the information gathered, I can now draft a comprehensive response to this Databricks Community question about the Terraform authentication issue.&lt;/P&gt;
&lt;P&gt;## Draft Response for Databricks Community&lt;/P&gt;
&lt;P&gt;The authentication error you're encountering occurs because the Databricks Terraform provider needs proper Application Default Credentials (ADC) configured when using the `google_service_account` parameter. The issue is that while you've specified the service account in your provider configuration, Terraform cannot automatically generate the necessary authentication tokens without additional setup.&lt;/P&gt;
&lt;P&gt;&lt;FONT size="5"&gt;Solution&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;To resolve this issue, you need to set up &lt;STRONG&gt;Google Cloud ID authentication&lt;/STRONG&gt; with impersonation. Here's what needs to be configured:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Step 1: Ensure Service Account Permissions&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;The Google Cloud service account specified in `local.gcp_sa` must be added as a user in your Databricks workspace with appropriate permissions to create groups and manage permissions.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Step 2: Configure Authentication via Google Cloud CLI&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Before running Terraform, you need to authenticate using the Google Cloud CLI with impersonation. Run this command in your terminal:&lt;/P&gt;
&lt;P&gt;```bash&lt;BR /&gt;gcloud auth login --impersonate-service-account=YOUR_SERVICE_ACCOUNT_EMAIL&lt;BR /&gt;```&lt;/P&gt;
&lt;P&gt;Replace `YOUR_SERVICE_ACCOUNT_EMAIL` with the email address of your service account (e.g., `service-account@project.iam.gserviceaccount.com`) .&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Step 3: Set Application Default Credentials&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;After authentication, set up Application Default Credentials that Terraform can use:&lt;/P&gt;
&lt;P&gt;```bash&lt;BR /&gt;gcloud auth application-default login&lt;BR /&gt;```&lt;/P&gt;
&lt;P&gt;This ensures that the Terraform provider can access the credentials needed to authenticate on behalf of the service account.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Step 4: Verify IAM Permissions&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Your Google Cloud user account needs the following IAM roles to impersonate the service account:&lt;/P&gt;
&lt;P&gt;- Service Account Token Creator&lt;BR /&gt;- Service Account User&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Alternative Approach: Use Environment Variables&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;If you prefer not to use impersonation, you can set environment variables that the Databricks provider will automatically detect [4]:&lt;/P&gt;
&lt;P&gt;```bash&lt;BR /&gt;export DATABRICKS_HOST="your-workspace-url"&lt;BR /&gt;export DATABRICKS_GOOGLE_SERVICE_ACCOUNT="service-account@project.iam.gserviceaccount.com"&lt;BR /&gt;```&lt;/P&gt;
&lt;P&gt;Then simplify your provider configuration:&lt;/P&gt;
&lt;P&gt;```hcl&lt;BR /&gt;provider "databricks" {&lt;BR /&gt;alias = "workspace"&lt;BR /&gt;}&lt;BR /&gt;```&lt;/P&gt;
&lt;P&gt;The provider will automatically pick up these environment variables.&lt;/P&gt;
&lt;P&gt;&lt;FONT size="5"&gt;Why Token-Based Authentication Works&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;When you manually specify `host` and `token` in `.databrickscfg`, you're using Personal Access Token (PAT) authentication, which doesn't require the complex OAuth flow that Google Cloud ID authentication uses. However, using service accounts is more secure for automation scenarios and doesn't require managing PAT expiration.&lt;/P&gt;
&lt;P&gt;&lt;FONT size="5"&gt;Additional Verification&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;After configuring authentication, test it with the Databricks CLI before running Terraform:&lt;/P&gt;
&lt;P&gt;```bash&lt;BR /&gt;databricks groups list&lt;BR /&gt;```&lt;/P&gt;
&lt;P&gt;If this command succeeds, your Terraform configuration should work as well.&lt;/P&gt;
&lt;P&gt;Regards, Louis&lt;/P&gt;</description>
      <pubDate>Mon, 20 Oct 2025 18:44:44 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/unable-to-create-databricks-group-and-add-permission-via/m-p/135447#M50352</guid>
      <dc:creator>Louis_Frolio</dc:creator>
      <dc:date>2025-10-20T18:44:44Z</dc:date>
    </item>
  </channel>
</rss>

