dbt-labs / terraform-provider-dbtcloud

dbt Cloud Terraform Provider
https://registry.terraform.io/providers/dbt-labs/dbtcloud
MIT License
82 stars 19 forks source link

Unable to create Databricks Connection #113

Closed edebrye closed 1 year ago

edebrye commented 1 year ago

Hi ! I was trying to create a Databricks connection, and it seems like the functionality was implemented. However, when I try to create a databricks connection :

resource "dbt_cloud_connection" "databricks" {
  project_id = dbt_cloud_project.self.id

  database =  ""
  name     = "Databricks"
  type     = "adapter"

  host_name = var.databricks_host
  http_path = var.databricks_path
}

The apply throws an error from dbt API :

module.test_dc.module.projects["test-dc"].dbt_cloud_connection.databricks: Creating...
╷
│ Error: POST url: https://emea.dbt.com/api/v3/accounts/<account_id>/projects/<project_id>/connections/, status: 500, body: {"status":{"code":500,"is_success":false,"user_message":"There was a server error. Please contact support!","developer_message":""},"data":null}
│ 
│   with module.test_dc.module.projects["test-dc"].dbt_cloud_connection.databricks,
│   on modules/dbt-project/project.tf line 10, in resource "dbt_cloud_connection" "databricks":
│   10: resource "dbt_cloud_connection" "databricks" {
│ 
╵

After reading dbt unofficial documentation (API v3) about how to create programatically a databricks connection, it seems that the provider should create first an adapter, which is not done in this provider. I successfully created a databricks connection, creating the adapter first, via the Postman collection.

Suggestions of solution

I will be happy to contribute if needed :)