Databricks OBO token lifetime is unspecified

Limit the lifetime of Databricks tokens issued on behalf of service principals.

Description

In a Databricks workspace on AWS or GCP, a workspace administrator can issue a service principal’s first personal access token with databricks_obo_token. Give the service principal permission to use personal access tokens and set lifetime_seconds to match the task and workspace policy.

Potential impact

Without an explicit lifetime, a token can outlive the task. If exposed, it can be used with the service principal’s permissions until revocation or expiry.

Remediation

For planned rotation, issue a replacement before expiry, update the integration that stores it and verify the connection. Revoke exposed tokens. Re-creating the token in Terraform does not deliver the new value to its consumers.

Examples

The second example uses 3600 seconds, or one hour. Configure the workspace provider, referenced service principal and group membership.

Before

hcl
resource "databricks_obo_token" "example" {
  depends_on     = [databricks_group_member.this]
  application_id = databricks_service_principal.this.application_id
  comment        = "PAT on behalf of ${databricks_service_principal.this.display_name}"
}

After

hcl
resource "databricks_obo_token" "example" {
  depends_on       = [databricks_group_member.this]
  application_id   = databricks_service_principal.this.application_id
  comment          = "PAT on behalf of ${databricks_service_principal.this.display_name}"
  lifetime_seconds = 3600
}

References