<?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 databricks_grants fails because it keeps track of a removed principal in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/databricks-grants-fails-because-it-keeps-track-of-a-removed/m-p/71171#M34265</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;My terraform script fails on a databricks_grants with the error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;"Error: cannot update grants: Could not find principal with name DataUsers".&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The principal DataUsers does not exist anymore because it has previously been deleted by terraform.&lt;/LI&gt;&lt;LI&gt;Both databricks UI and databricks CLI confirm that this principal does not exist.&lt;/LI&gt;&lt;LI&gt;There is no trace about DataUsers in the terraform state&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;The terraform sequence is as follow:&lt;/P&gt;&lt;P&gt;I have a list of groups to be created: groupList = ["DataUsers", "DataReaders"]&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Groups creation:with databricks_group along with a for_each loop on groupList&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;resource "databricks_group" "list_groups" {
  for_each     = var.groupList
  display_name = each.key
  force        = true
}​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Granting schema privileges to the groups: with databricks_grants&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;resource "databricks_grants" "schema_granting_groups" {
  for_each = toset(var.fmdp_schema_database_list)  
  schema = "${each.value}"

  dynamic "grant" {
    for_each = databricks_group.list_groups
    content {
      principal  = grant.value.display_name
      privileges = "USE_SCHEMA"
    }
  }
}​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Apply: terraform apply =&amp;gt; everything is created/configured as expected&lt;/LI&gt;&lt;LI&gt;Remove DataUsers from groupList: groupList = ["DataReaders"]&lt;/LI&gt;&lt;LI&gt;Apply: terraform apply =&amp;gt; &lt;EM&gt;"Error: cannot update grants: Could not find principal with name DataUsers"&lt;/EM&gt;&lt;/LI&gt;&lt;LI&gt;Check: based on databricks UI and databricks CLI, the apply (step5) &lt;STRONG&gt;succeeded as expected&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Based on implicit dependencies, databricks_groups is always executed before databricks_grants. It works well for terraform apply and terraform destroy, but in this use case it is a "replaced in place".. logically databricks_grant should have been called first to revoke the privilege on the group, before the group be removed. But this is not the case: databricks_groups is still called before databricks_grants, which could justify the error..&lt;BR /&gt;&lt;BR /&gt;This said, i was expecting that if we perform another terrafom apply, databricks_grants would be OK, because there is no trace of the removed group in its state. But for an unknown reason databricks_grants still wants to see the DataUsers group and struggles to revoke the privilege that was granted to DataUsers group..&lt;BR /&gt;&lt;BR /&gt;Any idea how it could be solved? How databricks_grants continues to reference a group that does not exist anymore in its terraform&amp;nbsp; state?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 31 May 2024 09:44:31 GMT</pubDate>
    <dc:creator>Pedro1</dc:creator>
    <dc:date>2024-05-31T09:44:31Z</dc:date>
    <item>
      <title>databricks_grants fails because it keeps track of a removed principal</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-grants-fails-because-it-keeps-track-of-a-removed/m-p/71171#M34265</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;My terraform script fails on a databricks_grants with the error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;"Error: cannot update grants: Could not find principal with name DataUsers".&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The principal DataUsers does not exist anymore because it has previously been deleted by terraform.&lt;/LI&gt;&lt;LI&gt;Both databricks UI and databricks CLI confirm that this principal does not exist.&lt;/LI&gt;&lt;LI&gt;There is no trace about DataUsers in the terraform state&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;The terraform sequence is as follow:&lt;/P&gt;&lt;P&gt;I have a list of groups to be created: groupList = ["DataUsers", "DataReaders"]&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Groups creation:with databricks_group along with a for_each loop on groupList&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;resource "databricks_group" "list_groups" {
  for_each     = var.groupList
  display_name = each.key
  force        = true
}​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Granting schema privileges to the groups: with databricks_grants&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;resource "databricks_grants" "schema_granting_groups" {
  for_each = toset(var.fmdp_schema_database_list)  
  schema = "${each.value}"

  dynamic "grant" {
    for_each = databricks_group.list_groups
    content {
      principal  = grant.value.display_name
      privileges = "USE_SCHEMA"
    }
  }
}​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Apply: terraform apply =&amp;gt; everything is created/configured as expected&lt;/LI&gt;&lt;LI&gt;Remove DataUsers from groupList: groupList = ["DataReaders"]&lt;/LI&gt;&lt;LI&gt;Apply: terraform apply =&amp;gt; &lt;EM&gt;"Error: cannot update grants: Could not find principal with name DataUsers"&lt;/EM&gt;&lt;/LI&gt;&lt;LI&gt;Check: based on databricks UI and databricks CLI, the apply (step5) &lt;STRONG&gt;succeeded as expected&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Based on implicit dependencies, databricks_groups is always executed before databricks_grants. It works well for terraform apply and terraform destroy, but in this use case it is a "replaced in place".. logically databricks_grant should have been called first to revoke the privilege on the group, before the group be removed. But this is not the case: databricks_groups is still called before databricks_grants, which could justify the error..&lt;BR /&gt;&lt;BR /&gt;This said, i was expecting that if we perform another terrafom apply, databricks_grants would be OK, because there is no trace of the removed group in its state. But for an unknown reason databricks_grants still wants to see the DataUsers group and struggles to revoke the privilege that was granted to DataUsers group..&lt;BR /&gt;&lt;BR /&gt;Any idea how it could be solved? How databricks_grants continues to reference a group that does not exist anymore in its terraform&amp;nbsp; state?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2024 09:44:31 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-grants-fails-because-it-keeps-track-of-a-removed/m-p/71171#M34265</guid>
      <dc:creator>Pedro1</dc:creator>
      <dc:date>2024-05-31T09:44:31Z</dc:date>
    </item>
    <item>
      <title>Re: databricks_grants fails because it keeps track of a removed principal</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-grants-fails-because-it-keeps-track-of-a-removed/m-p/71182#M34266</link>
      <description>&lt;P&gt;Terraform databricks provider= &lt;SPAN&gt;1.45.0&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2024 10:47:06 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-grants-fails-because-it-keeps-track-of-a-removed/m-p/71182#M34266</guid>
      <dc:creator>Pedro1</dc:creator>
      <dc:date>2024-05-31T10:47:06Z</dc:date>
    </item>
    <item>
      <title>Re: databricks_grants fails because it keeps track of a removed principal</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-grants-fails-because-it-keeps-track-of-a-removed/m-p/122056#M46637</link>
      <description>&lt;P&gt;&lt;EM&gt;I'm here searching for a similar but different issue, so this is just a suggestion of something to try..&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Have you tried setting a &lt;A href="https://developer.hashicorp.com/terraform/language/meta-arguments/depends_on" target="_self"&gt;depends_on&lt;/A&gt;&amp;nbsp;argument within your &lt;EM&gt;databricks_grants&lt;/EM&gt; block?&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jun 2025 03:47:00 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-grants-fails-because-it-keeps-track-of-a-removed/m-p/122056#M46637</guid>
      <dc:creator>wkeifenheim-og</dc:creator>
      <dc:date>2025-06-18T03:47:00Z</dc:date>
    </item>
  </channel>
</rss>

