Skip to content

Commit 0baf126

Browse files
authored
[Doc] Added more examples for databricks_connection (#4811)
## Changes - Add examples on how to create PowerBI & HTTP connection ## Tests <!-- How is this tested? Please see the checklist below and also describe any other relevant tests --> - [x] relevant change in `docs/` folder
1 parent af6bb94 commit 0baf126

File tree

2 files changed

+57
-8
lines changed

2 files changed

+57
-8
lines changed

NEXT_CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
* Recommend OAuth instead of PAT in guides ([#4787](https://github.com/databricks/terraform-provider-databricks/pull/4787))
2424
* Document new options in `databricks_model_serving` resource ([#4789](https://github.com/databricks/terraform-provider-databricks/pull/4789))
2525
* Added example of granting Account Admin role with `databricks_service_principal_role` resource ([#4807](https://github.com/databricks/terraform-provider-databricks/pull/4807))
26+
* Added more examples for `databricks_connection` ([#4810](https://github.com/databricks/terraform-provider-databricks/pull/4810))
2627

2728
### Exporter
2829

docs/resources/connection.md

Lines changed: 56 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ subcategory: "Unity Catalog"
33
---
44
# databricks_connection (Resource)
55

6+
-> This resource can only be used with a workspace-level provider!
7+
68
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:
79

810
- A connection, a securable object in Unity Catalog that specifies a path and credentials for accessing an external database system.
911
- A foreign [catalog](catalog.md)
1012

11-
This resource manages connections in Unity Catalog
12-
13-
-> This resource can only be used with a workspace-level provider!
13+
This resource manages connections in Unity Catalog. Please note that OAuth U2M is not supported as it requires user interaction for authentication.
1414

1515
## Example Usage
1616

@@ -64,26 +64,74 @@ resource "databricks_connection" "bigquery" {
6464
Create a connection to builtin Hive Metastore
6565

6666
```hcl
67-
resource "databricks_connection" "this" {
67+
resource "databricks_connection" "hms" {
6868
name = "hms-builtin"
6969
connection_type = "HIVE_METASTORE"
7070
comment = "This is a connection to builtin HMS"
7171
options = {
7272
builtin = "true"
7373
}
7474
}
75+
76+
Create a HTTP connection with bearer token
77+
78+
```hcl
79+
resource "databricks_connection" "http_bearer" {
80+
name = "http_bearer"
81+
connection_type = "HTTP"
82+
comment = "This is a connection to a HTTP service"
83+
options = {
84+
host = "https://example.com"
85+
port = "8433"
86+
base_path = "/api/"
87+
bearer_token = "bearer_token"
88+
}
89+
}
90+
91+
Create a HTTP connection with OAuth M2M
92+
93+
```hcl
94+
resource "databricks_connection" "http_oauth" {
95+
name = "http_oauth"
96+
connection_type = "HTTP"
97+
comment = "This is a connection to a HTTP service"
98+
options = {
99+
host = "https://example.com"
100+
port = "8433"
101+
base_path = "/api/"
102+
client_id = "client_id"
103+
client_secret = "client_secret"
104+
oauth_scope = "channels:read channels:history chat:write"
105+
token_endpoint = "https://authorization-server.com/oauth/token"
106+
}
107+
}
108+
```
109+
110+
Create a PowerBI connection with OAuth M2M
111+
112+
```hcl
113+
resource "databricks_connection" "pbi" {
114+
name = "test-pbi"
115+
connection_type = "POWER_BI"
116+
options = {
117+
authorization_endpoint = "https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize"
118+
client_id = "client_id"
119+
client_secret = "client_secret"
120+
}
121+
}
75122
```
76123

77124
## Argument Reference
78125

79126
The following arguments are supported:
80127

81128
- `name` - Name of the Connection.
82-
- `connection_type` - Connection type. `BIGQUERY` `MYSQL` `POSTGRESQL` `SNOWFLAKE` `REDSHIFT` `SQLDW` `SQLSERVER`, `SALESFORCE`, `HIVE_METASTORE`, `GLUE`, `TERADATA`, `ORACLE` or `DATABRICKS` are supported. Up-to-date list of connection type supported is in the [documentation](https://docs.databricks.com/query-federation/index.html#supported-data-sources)
83-
- `options` - The key value of options required by the connection, e.g. `host`, `port`, `user`, `password` or `GoogleServiceAccountKeyJson`. Please consult the [documentation](https://docs.databricks.com/query-federation/index.html#supported-data-sources) for the required option.
129+
- `connection_type` - Connection type. `MYSQL`, `POSTGRESQL`, `SNOWFLAKE`, `REDSHIFT` `SQLDW`, `SQLSERVER`, `DATABRICKS`, `SALESFORCE`, `BIGQUERY`, `WORKDAY_RAAS`, `HIVE_METASTORE`, `GA4_RAW_DATA`, `SERVICENOW`, `SALESFORCE_DATA_CLOUD`, `GLUE`, `ORACLE`, `TERADATA`, `HTTP` or `POWER_BI` are supported. Up-to-date list of connection type supported is in the [documentation](https://docs.databricks.com/query-federation/index.html#supported-data-sources). Change forces creation of a new resource.
130+
- `options` - The key value of options required by the connection, e.g. `host`, `port`, `user`, `password`, `authorization_endpoint`, `client_id`, `client_secret` or `GoogleServiceAccountKeyJson`. Please consult the [documentation](https://docs.databricks.com/query-federation/index.html#supported-data-sources) for the required option.
84131
- `owner` - (Optional) Name of the connection owner.
85-
- `properties` - (Optional) Free-form connection properties.
86-
- `comment` - (Optional) Free-form text.
132+
- `properties` - (Optional) Free-form connection properties. Change forces creation of a new resource.
133+
- `comment` - (Optional) Free-form text. Change forces creation of a new resource.
134+
- `read_only` - (Optional) Indicates whether the connection is read-only. Change forces creation of a new resource.
87135

88136
## Attribute Reference
89137

0 commit comments

Comments
 (0)