I got an error when trying to create a grant to an existing catalog in an existing workspace
Terraform version being 1.5.5 Terraform databrick provider version being 0.5.7
Error: cannot create grants: Invalid JSON received (670 bytes): <!doctype html><html><head><meta charset="utf-8"/><meta http-equiv="Content-Language" content="en"/><title>Databricks - Sign In</title><meta name="viewport" content="width=960"/><link rel="icon" type="image/png" href="/favicon.ico"/><meta http-equiv="content-type" content="text/html; charset=UTF8"/><script>window.__DATABRICKS_SAFE_FLAGS__={"databricks.infra.showErrorModalOnFetchError":true,"databricks.fe.infra.useReact18":false}</script><link rel="icon" href="/favicon.ico"><script defer="defer" src="/static/js/login/login.256ddcb7.js"></script></head><body class="light-mode"><uses-legacy-bootstrap><div id="login-page"></div></uses-legacy-bootstrap></body></html>
with databricks_grants.unity_catalog_grants,
on grants.tf line 1, in resource "databricks_grants" "unity_catalog_grants":
1: resource "databricks_grants" "unity_catalog_grants"
The Terraform code is very simple as follows
provider "databricks" {
alias = "workspace"
host = local.databricks_workspace_host
username = data.vault_generic_secret.databricks.data["databricks_account_username"]
password = data.vault_generic_secret.databricks.data["databricks_account_password"]
}
resource "databricks_grants" "unity_catalog_grants" {
provider = databricks.workspace
catalog = "catalog"
grant {
principal = local.workspace_users_group
privileges = ["USE_CATALOG", "USE_SCHEMA", "CREATE_SCHEMA", "CREATE_TABLE"]
}
}
I ever tried to upgrade provider to the latest(version 1.23.0), and got following error message:
Error: cannot create grants: invalid character '<' looking for beginning of value
I assume the problem is the same, it got the html login page returned, not expected Json string.
Could you advise what the root cause is? Thanks in advance.
The issue is similar to this one, but my databricks is built in AWS. Azure databrick terraform provider authentication setup for admin user creation
Tried provider version 0.5.7 and latest 1.23.0. Also tried with username/password and token auth methods. With the same host and token, I can create resources by python, it doesn't work with Terraform for some reason.