<?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: How to Set Custom Expiration Time for TOKEN Authentication in Databricks Recipient using Terrafo in Get Started Discussions</title>
    <link>https://community.databricks.com/t5/get-started-discussions/how-to-set-custom-expiration-time-for-token-authentication-in/m-p/100616#M4625</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/104469"&gt;@Sudheer2&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Could you please try enabling debug logs?&lt;/P&gt;
&lt;P&gt;TF_LOG=DEBUG DATABRICKS_DEBUG_TRUNCATE_BYTES=250000 terraform apply -no-color 2&amp;gt;&amp;amp;1 |tee tf-debug.log&lt;/P&gt;</description>
    <pubDate>Mon, 02 Dec 2024 13:12:49 GMT</pubDate>
    <dc:creator>Alberto_Umana</dc:creator>
    <dc:date>2024-12-02T13:12:49Z</dc:date>
    <item>
      <title>How to Set Custom Expiration Time for TOKEN Authentication in Databricks Recipient using Terraform?</title>
      <link>https://community.databricks.com/t5/get-started-discussions/how-to-set-custom-expiration-time-for-token-authentication-in/m-p/100393#M4619</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello Databricks Community,&lt;/P&gt;&lt;P&gt;I am using Terraform to create a Databricks recipient for sharing data with a non-Databricks user. The recipient is set up with authentication_type = "TOKEN", which generates a temporary URL to download a credentials file. By default, this URL expires after a certain period.&lt;/P&gt;&lt;P&gt;I would like to set a custom expiration time for the generated token (e.g., "2025-02-27T06:44:20.291Z"). However, it seems that Terraform is using the default expiration time and I can't find a way to specify the expiration time explicitly in the Terraform configuration.&lt;/P&gt;&lt;P&gt;Here’s the Terraform resource definition I am using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;hcl&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Copy code&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;DIV class=""&gt;resource "databricks_recipient" "external_recipient" { name = var.recipient_name comment = "Created by Terraform" authentication_type = "TOKEN" ip_access_list { allowed_ip_addresses = [] # Define allowed IPv4 addresses (optional) } }&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Questions:&lt;/STRONG&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;How can I set a custom expiration time for the generated token URL when creating a recipient using Terraform?&lt;/LI&gt;&lt;LI&gt;Is there an option in the Databricks API or Terraform provider to specify the expiration time for the credentials file?&lt;P&gt;Thank you in advance for your help!&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 29 Nov 2024 07:04:10 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/how-to-set-custom-expiration-time-for-token-authentication-in/m-p/100393#M4619</guid>
      <dc:creator>Sudheer2</dc:creator>
      <dc:date>2024-11-29T07:04:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set Custom Expiration Time for TOKEN Authentication in Databricks Recipient using Terrafo</title>
      <link>https://community.databricks.com/t5/get-started-discussions/how-to-set-custom-expiration-time-for-token-authentication-in/m-p/100436#M4620</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/104469"&gt;@Sudheer2&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Currently, the Terraform provider for Databricks does not support setting a custom expiration time for the generated token URL when creating a recipient with &lt;/SPAN&gt;&lt;CODE&gt;authentication_type = "TOKEN"&lt;/CODE&gt;&lt;SPAN&gt;. The expiration time is automatically determined and cannot be explicitly specified in the Terraform configuration&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;For now, you might need to manage the token expiration manually or use the Databricks API directly to create the recipient with the desired expiration time.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;There is a feature request internally to implement this.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="_1t7bu9h1 paragraph"&gt;&lt;SPAN&gt;Use the Databricks REST API to create a recipient with a custom expiration time:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="gb5fhw1"&gt;
&lt;PRE&gt;&lt;CODE class="markdown-code-bash _1t7bu9hb hljs language-bash gb5fhw2"&gt;curl -X POST https://&amp;lt;databricks-instance&amp;gt;/api/2.0/unity-catalog/recipients \
-H &lt;SPAN class="hljs-string"&gt;"Authorization: Bearer &amp;lt;your-access-token&amp;gt;"&lt;/SPAN&gt; \
-H &lt;SPAN class="hljs-string"&gt;"Content-Type: application/json"&lt;/SPAN&gt; \
-d &lt;SPAN class="hljs-string"&gt;'{
  "name": "&amp;lt;recipient-name&amp;gt;",
  "comment": "Created by API",
  "authentication_type": "TOKEN",
  "expiration_time": "2025-02-27T06:44:20.291Z"
}'&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV class="gb5fhw3"&gt;
&lt;DIV class="gb5fhw4"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 29 Nov 2024 15:15:45 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/how-to-set-custom-expiration-time-for-token-authentication-in/m-p/100436#M4620</guid>
      <dc:creator>Alberto_Umana</dc:creator>
      <dc:date>2024-11-29T15:15:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set Custom Expiration Time for TOKEN Authentication in Databricks Recipient using Terrafo</title>
      <link>https://community.databricks.com/t5/get-started-discussions/how-to-set-custom-expiration-time-for-token-authentication-in/m-p/100608#M4624</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello &amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/106294"&gt;@Alberto_Umana&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your helpful response. I followed your suggestion to use a&lt;SPAN&gt;&amp;nbsp;null_resource&lt;SPAN&gt;&amp;nbsp;with the&lt;SPAN&gt;&amp;nbsp;local-exec&lt;SPAN&gt;&amp;nbsp;provisioner to make the API call to create a recipient. However, I’m facing an issue where the resource is being reported as created in the Terraform output (i.e., "1 resource added"), but I cannot see the recipient in the Databricks workspace.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Here’s the Terraform configuration I’m using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;DIV class=""&gt;resource "null_resource" "create_recipient" { provisioner "local-exec" { command = &amp;lt;&amp;lt;EOT echo "Calling Databricks API to create recipient..." RESPONSE=$(curl -s -X POST "${var.databricks_host}/api/2.0/unity-catalog/recipients" \ -H "Authorization: Bearer ${var.databricks_token}" \ -H "Content-Type: application/json" \ -d '{ "name": "${var.recipient_name}", "comment": "Created by API", "authentication_type": "TOKEN", "expiration_time": "2024-12-04T06:44:20.291Z" }') echo $RESPONSE &amp;gt; recipient_response.json EOT } triggers = { recipient_name = var.recipient_name } }&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;The&lt;SPAN&gt;&amp;nbsp;local-exec&lt;SPAN&gt;&amp;nbsp;provisioner is executing the&lt;SPAN&gt;&amp;nbsp;curl&lt;SPAN&gt;&amp;nbsp;command successfully, but when I check the Databricks workspace, the recipient doesn’t appear.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;A few things I’ve tried:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Checked the response returned by the&lt;SPAN&gt;&amp;nbsp;curl&lt;SPAN&gt;&amp;nbsp;call (which is written to&lt;SPAN&gt;&amp;nbsp;recipient_response.json), but there’s no error message. It appears the request was successful.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;Confirmed that the&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;databricks_host&lt;SPAN&gt;&amp;nbsp;and&lt;SPAN&gt;&amp;nbsp;databricks_token&lt;SPAN&gt;&amp;nbsp;variables are set correctly.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;P&gt;Do you have any additional suggestions on troubleshooting this issue? Specifically, is there a way to check the actual result of the API call directly, or should I be using a different method to confirm the recipient creation?&lt;/P&gt;&lt;P&gt;Looking forward to your advice.&lt;/P&gt;&lt;P&gt;Best regards,&lt;BR /&gt;Sudheer Ch.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/106294"&gt;@Alberto_Umana&lt;/a&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2024 11:59:38 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/how-to-set-custom-expiration-time-for-token-authentication-in/m-p/100608#M4624</guid>
      <dc:creator>Sudheer2</dc:creator>
      <dc:date>2024-12-02T11:59:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to Set Custom Expiration Time for TOKEN Authentication in Databricks Recipient using Terrafo</title>
      <link>https://community.databricks.com/t5/get-started-discussions/how-to-set-custom-expiration-time-for-token-authentication-in/m-p/100616#M4625</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/104469"&gt;@Sudheer2&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Could you please try enabling debug logs?&lt;/P&gt;
&lt;P&gt;TF_LOG=DEBUG DATABRICKS_DEBUG_TRUNCATE_BYTES=250000 terraform apply -no-color 2&amp;gt;&amp;amp;1 |tee tf-debug.log&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2024 13:12:49 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/how-to-set-custom-expiration-time-for-token-authentication-in/m-p/100616#M4625</guid>
      <dc:creator>Alberto_Umana</dc:creator>
      <dc:date>2024-12-02T13:12:49Z</dc:date>
    </item>
  </channel>
</rss>

