<?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: Terraform databricks_storage_credential has wrong External ID in Get Started Discussions</title>
    <link>https://community.databricks.com/t5/get-started-discussions/terraform-databricks-storage-credential-has-wrong-external-id/m-p/57630#M6380</link>
    <description>&lt;P&gt;Configure your provider with credentials that have been granted the account admin role. This solution means every storage credential created by this provider will have the Databricks Account ID as the external id value.&lt;/P&gt;&lt;P&gt;If that doesn't work for you then the only other solution is to make the process a two-step workflow so you can look up the external id (confirmed: it's just a random UUID if created by a user without the account admin role).&lt;/P&gt;</description>
    <pubDate>Wed, 17 Jan 2024 22:53:57 GMT</pubDate>
    <dc:creator>dvmentalmadess</dc:creator>
    <dc:date>2024-01-17T22:53:57Z</dc:date>
    <item>
      <title>Terraform databricks_storage_credential has wrong External ID</title>
      <link>https://community.databricks.com/t5/get-started-discussions/terraform-databricks-storage-credential-has-wrong-external-id/m-p/54153#M6372</link>
      <description>&lt;P&gt;We create storage credentials using Terraform. I don't see any way to specify a given External ID (DBR Account ID) when creating the credentials via Terraform or in the web UI console. However, today when I tried creating a new set of credentials using the same custom Terraform module we've used for every other storage credential, the external ID assigned to the credentials is different from all of our other storage credentials.&lt;/P&gt;&lt;P&gt;As a result, I'm unable to use the storage credentials. I get forbidden errors from S3 whenever I try to create a new external location using our terraform module. I am completely blocked from adding new sources to our production unity catalog using our automation. NOTE: this does not happen if I manually create credentials using the web UI.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Screenshot 2023-11-28 at 6.37.50 PM.png" style="width: 999px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/5379i7AE97706E3BB8A9E/image-size/large/is-moderation-mode/true?v=v2&amp;amp;px=999" role="button" title="Screenshot 2023-11-28 at 6.37.50 PM.png" alt="Screenshot 2023-11-28 at 6.37.50 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;While I could incorporate the "new" external id into my IAM policies, there is no way to get it from the Terraform resource attributes after it has been created. Also, the IAM role must be created before the storage credential. This seems like a bug, but I can't find any other instance of this happening elsewhere.&lt;/P&gt;&lt;P&gt;UPDATE: It appears the External ID of the storage credential is now different each time I re-create it (destroy then create).&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2023 02:10:30 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/terraform-databricks-storage-credential-has-wrong-external-id/m-p/54153#M6372</guid>
      <dc:creator>dvmentalmadess</dc:creator>
      <dc:date>2023-11-29T02:10:30Z</dc:date>
    </item>
    <item>
      <title>Re: Terraform databricks_storage_credential has wrong External ID</title>
      <link>https://community.databricks.com/t5/get-started-discussions/terraform-databricks-storage-credential-has-wrong-external-id/m-p/54229#M6373</link>
      <description>&lt;P&gt;UPDATE: I was able to manually work around the issue.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Run &lt;FONT face="courier new,courier"&gt;terraform apply&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;After apply fails, copy the IAM role ARN and name before deleting the storage credential with the incorrect &lt;FONT face="courier new,courier"&gt;External ID&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;Manually create the storage credential using the same IAM role and name copied from the storage credential deleted in the previous step&lt;/LI&gt;&lt;LI&gt;Re-run &lt;FONT face="courier new,courier"&gt;terraform plan&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;Re-run &lt;FONT face="courier new,courier"&gt;terraform apply&lt;/FONT&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;While this is workable, I don't consider it a permanent solution and I would still appreciate a solution that will remove the need for a manual work around.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2023 16:36:57 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/terraform-databricks-storage-credential-has-wrong-external-id/m-p/54229#M6373</guid>
      <dc:creator>dvmentalmadess</dc:creator>
      <dc:date>2023-11-29T16:36:57Z</dc:date>
    </item>
    <item>
      <title>Re: Terraform databricks_storage_credential has wrong External ID</title>
      <link>https://community.databricks.com/t5/get-started-discussions/terraform-databricks-storage-credential-has-wrong-external-id/m-p/54914#M6374</link>
      <description>&lt;P&gt;I am having a similar problem. So we have one storage credential and added the permission for a new bucket to the IAM role. When deploying with Terraform, we get this error:&lt;/P&gt;&lt;P&gt;Error: cannot create external location: AWS IAM role does not have READ permissions on url s3://...&lt;/P&gt;&lt;P&gt;When deploying with it via UI, it can't validate the read permissions, but the creation works. Also, I created an external table and was able to query it. Is there some caching issue or why is it unable to pick up the changed permissions?&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2023 10:11:54 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/terraform-databricks-storage-credential-has-wrong-external-id/m-p/54914#M6374</guid>
      <dc:creator>Gozrehm</dc:creator>
      <dc:date>2023-12-08T10:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: Terraform databricks_storage_credential has wrong External ID</title>
      <link>https://community.databricks.com/t5/get-started-discussions/terraform-databricks-storage-credential-has-wrong-external-id/m-p/56442#M6375</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/67356"&gt;@Gozrehm&lt;/a&gt;not clear if this is the same thing, but I'm thinking you're experiencing a different issue. In my experience, it is common to see race conditions where Databricks doesn't see an expected change right away. I believe this is because the AWS API is often eventually consistent. In this kind of scenario, I'll often add a &lt;A href="https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/sleep" target="_self"&gt;time_sleep&lt;/A&gt; resource to my terraform and use the `create_duration` attribute to handle this kind of scenario.&lt;/P&gt;&lt;P&gt;Another option is to use the `skip_validation` attribute of the `databricks_external_location` resource. This should work without having to introduce time_sleep, but just know that if there is any issues with your IAM policy you will see them crop up at run time instead of during deployment so make sure you account for that.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2024 17:51:20 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/terraform-databricks-storage-credential-has-wrong-external-id/m-p/56442#M6375</guid>
      <dc:creator>dvmentalmadess</dc:creator>
      <dc:date>2024-01-04T17:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: Terraform databricks_storage_credential has wrong External ID</title>
      <link>https://community.databricks.com/t5/get-started-discussions/terraform-databricks-storage-credential-has-wrong-external-id/m-p/56443#M6376</link>
      <description>&lt;P&gt;I was able to get some help from Databricks support and finally confirmed the cause of the behavior: &lt;A href="https://docs.databricks.com/en/release-notes/product/2023/november.html#iam-policies-for-storage-credentials-now-require-an-external-id" target="_self"&gt;IAM policies for storage credentials now require an external ID&lt;/A&gt; (Nov 30, 2023). We have been using external ID since April '23, but this change broke us for a reason not mentioned in the documentation: external ID will be different depending upon the role of the user who creates the storage credential:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Account Admin: external ID will be the Databricks Account ID - this matches the behavior we've been relying on and that was recommended in the documentation when we build our implementation back in April. This is also why my manual workaround was successful, because I am an account admin.&lt;/LI&gt;&lt;LI&gt;All other roles: external ID will be a random UUID - this is new behavior as of Nov 30, 2023 and it was what we started seeing in our CD pipeline using Terraform apply.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;The terraform storage credential resource does not return external ID so it's currently impossible to use terraform for creating storage credentials with anything other than an account admin role. The solution is we will have to use an account admin instead of just a workspace admin to create the storage credential resource. We might be able to create an additional databricks provider instance that is solely for the purpose of creating storage credentials so it doesn't change how we create our other resources. This won't be a big effort to change this since we are already using two providers: one for the Databricks Account API and one for the Databricks workspace API - we can just pass the account credentials we are already using to another provider (or replace the ones we're currently using for the workspace API)&lt;/P&gt;&lt;P&gt;ASIDE: I was worried that the random external ID values represented Databricks account IDs for other accounts. It was confirmed by support that this is not the case - they really are just random values and not anything else so there's no security issue created here.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2024 18:18:31 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/terraform-databricks-storage-credential-has-wrong-external-id/m-p/56443#M6376</guid>
      <dc:creator>dvmentalmadess</dc:creator>
      <dc:date>2024-01-04T18:18:31Z</dc:date>
    </item>
    <item>
      <title>Re: Terraform databricks_storage_credential has wrong External ID</title>
      <link>https://community.databricks.com/t5/get-started-discussions/terraform-databricks-storage-credential-has-wrong-external-id/m-p/57069#M6377</link>
      <description>&lt;P class=""&gt;I tried the proposed solution using an account provider like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;provider "databricks" {
  account_id = "ACCOUNT_ID"
  host       = "https://accounts.cloud.databricks.com"
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;for creating the storage credential. However, that did not work. I got an exception:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Error: cannot create storage credential: No API found for 'POST /accounts/ACCOUNT_ID/metastores/storage-credentials'
│ 
│   with databricks_storage_credential.external,
│   on external-storage.tf line 3, in resource "databricks_storage_credential" "external":
│    3: resource "databricks_storage_credential" "external" {&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;Question:&lt;BR /&gt;Is it possible to create storage credentials via tf atm and if so, how should I configure the provider?&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2024 13:57:11 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/terraform-databricks-storage-credential-has-wrong-external-id/m-p/57069#M6377</guid>
      <dc:creator>Mathias_Peters</dc:creator>
      <dc:date>2024-01-12T13:57:11Z</dc:date>
    </item>
    <item>
      <title>Re: Terraform databricks_storage_credential has wrong External ID</title>
      <link>https://community.databricks.com/t5/get-started-discussions/terraform-databricks-storage-credential-has-wrong-external-id/m-p/57071#M6378</link>
      <description>&lt;P&gt;Were you able to solve our issue? If so, how?&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2024 14:25:26 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/terraform-databricks-storage-credential-has-wrong-external-id/m-p/57071#M6378</guid>
      <dc:creator>Mathias_Peters</dc:creator>
      <dc:date>2024-01-12T14:25:26Z</dc:date>
    </item>
    <item>
      <title>Re: Terraform databricks_storage_credential has wrong External ID</title>
      <link>https://community.databricks.com/t5/get-started-discussions/terraform-databricks-storage-credential-has-wrong-external-id/m-p/57075#M6379</link>
      <description>&lt;P&gt;We are using a service principal for TF deployment. It has account admin permission. For creating the storage credentials, we are using workspace level provider:&lt;/P&gt;&lt;P&gt;provider "databricks" {&lt;BR /&gt;alias = "workspace"&lt;BR /&gt;host = "&lt;A href="https://dbc-XXXX.cloud.databricks.com" target="_blank"&gt;https://dbc-XXXX.cloud.databricks.com&lt;/A&gt;"&lt;BR /&gt;auth_type = "oauth-m2m"&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;# Storage credential for external sources&lt;BR /&gt;resource "databricks_storage_credential" "external_source" {&lt;BR /&gt;name = "${local.prefix}_${local.external_source_credential_name}"&lt;BR /&gt;aws_iam_role {&lt;BR /&gt;role_arn = var.external_source_role_arn&lt;BR /&gt;}&lt;BR /&gt;provider = databricks.workspace&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Then for adding an additional external location to an existing credential, I faced an issue during apply.&amp;nbsp; What helped for me, setting&amp;nbsp;skip_validation = true:&lt;/P&gt;&lt;P&gt;resource "databricks_external_location" "this" {&lt;BR /&gt;name = "${var.prefix}_${var.external_location_name}"&lt;BR /&gt;url = var.external_location_url&lt;BR /&gt;credential_name = var.storage_credentials_id&lt;BR /&gt;read_only = var.read_only&lt;BR /&gt;skip_validation = true&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;So now we can automate everything with TF. Hope that helps &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2024 14:48:14 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/terraform-databricks-storage-credential-has-wrong-external-id/m-p/57075#M6379</guid>
      <dc:creator>Gozrehm</dc:creator>
      <dc:date>2024-01-12T14:48:14Z</dc:date>
    </item>
    <item>
      <title>Re: Terraform databricks_storage_credential has wrong External ID</title>
      <link>https://community.databricks.com/t5/get-started-discussions/terraform-databricks-storage-credential-has-wrong-external-id/m-p/57630#M6380</link>
      <description>&lt;P&gt;Configure your provider with credentials that have been granted the account admin role. This solution means every storage credential created by this provider will have the Databricks Account ID as the external id value.&lt;/P&gt;&lt;P&gt;If that doesn't work for you then the only other solution is to make the process a two-step workflow so you can look up the external id (confirmed: it's just a random UUID if created by a user without the account admin role).&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2024 22:53:57 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/terraform-databricks-storage-credential-has-wrong-external-id/m-p/57630#M6380</guid>
      <dc:creator>dvmentalmadess</dc:creator>
      <dc:date>2024-01-17T22:53:57Z</dc:date>
    </item>
    <item>
      <title>Re: Terraform databricks_storage_credential has wrong External ID</title>
      <link>https://community.databricks.com/t5/get-started-discussions/terraform-databricks-storage-credential-has-wrong-external-id/m-p/57631#M6381</link>
      <description>&lt;P&gt;&amp;nbsp;The problem is your host should be the workspace url, not the account url. Also as mentioned before the credentials should have account admin privilege if you want to have it return a known external id.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2024 22:57:28 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/terraform-databricks-storage-credential-has-wrong-external-id/m-p/57631#M6381</guid>
      <dc:creator>dvmentalmadess</dc:creator>
      <dc:date>2024-01-17T22:57:28Z</dc:date>
    </item>
  </channel>
</rss>

