subcategory |
---|
Unity Catalog |
-> This resource can only be used with a workspace-level provider!
Lakehouse Federation is the query federation platform for Databricks. Databricks uses Unity Catalog to manage query federation. To make a dataset available for read-only querying using Lakehouse Federation, you create the following:
- A connection, a securable object in Unity Catalog that specifies a path and credentials for accessing an external database system.
- A foreign catalog
This resource manages connections in Unity Catalog
Create a connection to a MySQL database
resource "databricks_connection" "mysql" {
name = "mysql_connection"
connection_type = "MYSQL"
comment = "this is a connection to mysql db"
options = {
host = "test.mysql.database.azure.com"
port = "3306"
user = "user"
password = "password"
}
properties = {
purpose = "testing"
}
}
Create a connection to a BigQuery database
resource "databricks_connection" "bigquery" {
name = "bq_connection"
connection_type = "BIGQUERY"
comment = "this is a connection to BQ"
options = {
GoogleServiceAccountKeyJson = jsonencode({
"type" : "service_account",
"project_id" : "PROJECT_ID",
"private_key_id" : "KEY_ID",
"private_key" : "-----BEGIN PRIVATE KEY-----\nPRIVATE_KEY\n-----END PRIVATE KEY-----\n",
"client_email" : "SERVICE_ACCOUNT_EMAIL",
"client_id" : "CLIENT_ID",
"auth_uri" : "https://accounts.google.com/o/oauth2/auth",
"token_uri" : "https://accounts.google.com/o/oauth2/token",
"auth_provider_x509_cert_url" : "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url" : "https://www.googleapis.com/robot/v1/metadata/x509/SERVICE_ACCOUNT_EMAIL",
"universe_domain" : "googleapis.com"
})
}
properties = {
purpose = "testing"
}
}
The following arguments are supported:
name
- Name of the Connection.connection_type
- Connection type.BIGQUERY
MYSQL
POSTGRESQL
SNOWFLAKE
REDSHIFT
SQLDW
SQLSERVER
,SALESFORCE
orDATABRICKS
are supported. Up-to-date list of connection type supportedoptions
- The key value of options required by the connection, e.g.host
,port
,user
,password
orGoogleServiceAccountKeyJson
. Please consult the documentation for the required option.owner
- (Optional) Name of the connection owner.properties
- (Optional) Free-form connection properties.comment
- (Optional) Free-form text.
In addition to all arguments above, the following attributes are exported:
id
- ID of this connection in form of<metastore_id>|<name>
.
This resource can be imported by id
:
terraform import databricks_connection.this '<metastore_id>|<name>'