Skip to content

Commit 6becd00

Browse files
authored
Merge pull request #227 from dbt-labs/release-0.2.17
Release 0.2.17
2 parents d16c272 + 0d53965 commit 6becd00

34 files changed

+2584
-305
lines changed

CHANGELOG.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,18 @@
22

33
All notable changes to this project will be documented in this file.
44

5-
## [Unreleased](https://github.com/dbt-labs/terraform-provider-dbtcloud/compare/v0.2.16...HEAD)
5+
## [Unreleased](https://github.com/dbt-labs/terraform-provider-dbtcloud/compare/v0.2.17...HEAD)
6+
7+
## [0.2.17](https://github.com/dbt-labs/terraform-provider-dbtcloud/compare/v0.2.16...v0.2.17)
8+
9+
## Changes
10+
11+
- #224 - add the resources `dbtcloud_fabric_connection` and `dbtcloud_fabric_credential` to allow using dbt Cloud along with Microsoft Fabric
12+
- #222 - allow users to set Slack notifications from Terraform
13+
14+
## Behind the scenes
15+
16+
- Refactor some of the shared code for Adapters and connections
617

718
## [0.2.16](https://github.com/dbt-labs/terraform-provider-dbtcloud/compare/v0.2.15...v0.2.16)
819

docs/resources/fabric_connection.md

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
page_title: "dbtcloud_fabric_connection Resource - dbtcloud"
3+
subcategory: ""
4+
description: |-
5+
Resource to create Microsoft Fabric connections in dbt Cloud
6+
---
7+
8+
# dbtcloud_fabric_connection (Resource)
9+
10+
11+
Resource to create Microsoft Fabric connections in dbt Cloud
12+
13+
## Example Usage
14+
15+
```terraform
16+
resource "dbtcloud_fabric_connection" "my_fabric_connection" {
17+
project_id = dbtcloud_project.dbt_project.id
18+
name = "Connection Name"
19+
server = "my-server"
20+
database = "my-database"
21+
port = 1234
22+
login_timeout = 30
23+
}
24+
```
25+
26+
<!-- schema generated by tfplugindocs -->
27+
## Schema
28+
29+
### Required
30+
31+
- `database` (String) The database to connect to for this connection.
32+
- `name` (String) Connection name
33+
- `port` (Number) The port to connect to for this connection.
34+
- `project_id` (Number) Project ID to create the connection in
35+
- `server` (String) The server hostname.
36+
37+
### Optional
38+
39+
- `login_timeout` (Number) The number of seconds used to establish a connection before failing. Defaults to 0, which means that the timeout is disabled or uses the default system settings.
40+
- `query_timeout` (Number) The number of seconds used to wait for a query before failing. Defaults to 0, which means that the timeout is disabled or uses the default system settings.
41+
- `retries` (Number) The number of automatic times to retry a query before failing. Defaults to 1. Queries with syntax errors will not be retried. This setting can be used to overcome intermittent network issues.
42+
43+
### Read-Only
44+
45+
- `adapter_id` (Number) Adapter id created for the Fabric connection
46+
- `connection_id` (Number) Connection Identifier
47+
- `id` (String) The ID of this resource.
48+
49+
## Import
50+
51+
Import is supported using the following syntax:
52+
53+
```shell
54+
terraform import dbtcloud_fabric_connection.my_connection "project_id:connection_id"
55+
terraform import dbtcloud_fabric_connection.my_connection 12345:6789
56+
```

docs/resources/fabric_credential.md

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
page_title: "dbtcloud_fabric_credential Resource - dbtcloud"
3+
subcategory: ""
4+
description: |-
5+
6+
---
7+
8+
# dbtcloud_fabric_credential (Resource)
9+
10+
11+
12+
13+
## Example Usage
14+
15+
```terraform
16+
# when using AD authentication
17+
resource "dbtcloud_databricks_credential" "my_databricks_cred" {
18+
project_id = dbtcloud_project.dbt_project.id
19+
adapter_id = dbtcloud_fabric_connection.my_fabric_connection.adapter_id
20+
schema = "my_schema"
21+
user = "my_user"
22+
password = "my_password"
23+
schema_authorization = "abcd"
24+
}
25+
26+
# when using service principal authentication
27+
resource "dbtcloud_databricks_credential" "my_spark_cred" {
28+
project_id = dbtcloud_project.dbt_project.id
29+
adapter_id = dbtcloud_fabric_connection.my_fabric_connection.adapter_id
30+
schema = "my_schema"
31+
client_id = "my_client_id"
32+
tenant_id = "my_tenant_id"
33+
client_secret = "my_secret"
34+
schema_authorization = "abcd"
35+
}
36+
```
37+
38+
<!-- schema generated by tfplugindocs -->
39+
## Schema
40+
41+
### Required
42+
43+
- `adapter_id` (Number) Fabric adapter ID for the credential
44+
- `project_id` (Number) Project ID to create the Fabric credential in
45+
- `schema` (String) The schema where to create the dbt models
46+
47+
### Optional
48+
49+
- `client_id` (String) The client ID of the Azure Active Directory service principal. This is only used when connecting to Azure SQL with an AAD service principal.
50+
- `client_secret` (String, Sensitive) The client secret of the Azure Active Directory service principal. This is only used when connecting to Azure SQL with an AAD service principal.
51+
- `password` (String, Sensitive) The password for the account to connect to. Only used when connection with AD user/pass
52+
- `schema_authorization` (String) Optionally set this to the principal who should own the schemas created by dbt
53+
- `tenant_id` (String) The tenant ID of the Azure Active Directory instance. This is only used when connecting to Azure SQL with a service principal.
54+
- `user` (String) The username of the Fabric account to connect to. Only used when connection with AD user/pass
55+
56+
### Read-Only
57+
58+
- `credential_id` (Number) The system Fabric credential ID
59+
- `id` (String) The ID of this resource.
60+
61+
## Import
62+
63+
Import is supported using the following syntax:
64+
65+
```shell
66+
# Import using a project ID and credential ID found in the URL or via the API.
67+
terraform import dbtcloud_fabric_credential.my_fabric_credential "project_id:credential_id"
68+
terraform import dbtcloud_fabric_credential.my_fabric_credential 12345:6789
69+
```

docs/resources/notification.md

+29-15
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,36 @@ description: |-
2323
// support will need to be contacted to restore access.
2424
// cmd: terraform import dbtcloud_notification.prod_job_internal_notification <user_id>
2525
resource "dbtcloud_notification" "prod_job_internal_notification" {
26-
// user_id is the internal ID of a given user in dbt Cloud
27-
user_id = 100
28-
on_success = [dbtcloud_job.prod_job.id]
29-
on_failure = [12345]
30-
// the Type 1 is used for internal notifications
31-
notification_type = 1
26+
// user_id is the internal ID of a given user in dbt Cloud
27+
user_id = 100
28+
on_success = [dbtcloud_job.prod_job.id]
29+
on_failure = [12345]
30+
// the Type 1 is used for internal notifications
31+
notification_type = 1
3232
}
3333
3434
// we can also send "external" email notifications to emails to related to dbt Cloud users
3535
resource "dbtcloud_notification" "prod_job_external_notification" {
36-
// we still need the ID of a user in dbt Cloud even though it is not used for sending notifications
37-
user_id = 100
38-
on_failure = [23456, 56788]
39-
on_cancel = [dbtcloud_job.prod_job.id]
40-
// the Type 4 is used for external notifications
41-
notification_type = 4
42-
// the external_email is the email address that will receive the notification
43-
external_email = "[email protected]"
36+
// we still need the ID of a user in dbt Cloud even though it is not used for sending notifications
37+
user_id = 100
38+
on_failure = [23456, 56788]
39+
on_cancel = [dbtcloud_job.prod_job.id]
40+
// the Type 4 is used for external notifications
41+
notification_type = 4
42+
// the external_email is the email address that will receive the notification
43+
external_email = "[email protected]"
44+
}
45+
46+
// and finally, we can set up Slack notifications
47+
resource "dbtcloud_notification" "prod_job_slack_notifications" {
48+
// we still need the ID of a user in dbt Cloud even though it is not used for sending notifications
49+
user_id = 100
50+
on_failure = [23456, 56788]
51+
on_cancel = [dbtcloud_job.prod_job.id]
52+
// the Type 2 is used for Slack notifications
53+
notification_type = 2
54+
slack_channel_id = "C12345ABCDE"
55+
slack_channel_name = "#my-awesome-channel"
4456
}
4557
```
4658

@@ -54,10 +66,12 @@ resource "dbtcloud_notification" "prod_job_external_notification" {
5466
### Optional
5567

5668
- `external_email` (String) The external email to receive the notification
57-
- `notification_type` (Number) Type of notification (1 = dbt Cloud user email (default): does not require an external_email ; 4 = external email: requires setting an external_email)
69+
- `notification_type` (Number) Type of notification (1 = dbt Cloud user email (default): does not require an external_email ; 2 = Slack channel: requires `slack_channel_id` and `slack_channel_name` ; 4 = external email: requires setting an `external_email`)
5870
- `on_cancel` (Set of Number) List of job IDs to trigger the webhook on cancel
5971
- `on_failure` (Set of Number) List of job IDs to trigger the webhook on failure
6072
- `on_success` (Set of Number) List of job IDs to trigger the webhook on success
73+
- `slack_channel_id` (String) The ID of the Slack channel to receive the notification. It can be found at the bottom of the Slack channel settings
74+
- `slack_channel_name` (String) The name of the slack channel
6175
- `state` (Number) State of the notification (1 = active (default), 2 = inactive)
6276

6377
### Read-Only
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
terraform import dbtcloud_fabric_connection.my_connection "project_id:connection_id"
2+
terraform import dbtcloud_fabric_connection.my_connection 12345:6789
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
resource "dbtcloud_fabric_connection" "my_fabric_connection" {
2+
project_id = dbtcloud_project.dbt_project.id
3+
name = "Connection Name"
4+
server = "my-server"
5+
database = "my-database"
6+
port = 1234
7+
login_timeout = 30
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Import using a project ID and credential ID found in the URL or via the API.
2+
terraform import dbtcloud_fabric_credential.my_fabric_credential "project_id:credential_id"
3+
terraform import dbtcloud_fabric_credential.my_fabric_credential 12345:6789
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# when using AD authentication
2+
resource "dbtcloud_databricks_credential" "my_databricks_cred" {
3+
project_id = dbtcloud_project.dbt_project.id
4+
adapter_id = dbtcloud_fabric_connection.my_fabric_connection.adapter_id
5+
schema = "my_schema"
6+
user = "my_user"
7+
password = "my_password"
8+
schema_authorization = "abcd"
9+
}
10+
11+
# when using service principal authentication
12+
resource "dbtcloud_databricks_credential" "my_spark_cred" {
13+
project_id = dbtcloud_project.dbt_project.id
14+
adapter_id = dbtcloud_fabric_connection.my_fabric_connection.adapter_id
15+
schema = "my_schema"
16+
client_id = "my_client_id"
17+
tenant_id = "my_tenant_id"
18+
client_secret = "my_secret"
19+
schema_authorization = "abcd"
20+
}

examples/resources/dbtcloud_notification/resource.tf

+26-14
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,34 @@
88
// support will need to be contacted to restore access.
99
// cmd: terraform import dbtcloud_notification.prod_job_internal_notification <user_id>
1010
resource "dbtcloud_notification" "prod_job_internal_notification" {
11-
// user_id is the internal ID of a given user in dbt Cloud
12-
user_id = 100
13-
on_success = [dbtcloud_job.prod_job.id]
14-
on_failure = [12345]
15-
// the Type 1 is used for internal notifications
16-
notification_type = 1
11+
// user_id is the internal ID of a given user in dbt Cloud
12+
user_id = 100
13+
on_success = [dbtcloud_job.prod_job.id]
14+
on_failure = [12345]
15+
// the Type 1 is used for internal notifications
16+
notification_type = 1
1717
}
1818

1919
// we can also send "external" email notifications to emails to related to dbt Cloud users
2020
resource "dbtcloud_notification" "prod_job_external_notification" {
21-
// we still need the ID of a user in dbt Cloud even though it is not used for sending notifications
22-
user_id = 100
23-
on_failure = [23456, 56788]
24-
on_cancel = [dbtcloud_job.prod_job.id]
25-
// the Type 4 is used for external notifications
26-
notification_type = 4
27-
// the external_email is the email address that will receive the notification
28-
external_email = "[email protected]"
21+
// we still need the ID of a user in dbt Cloud even though it is not used for sending notifications
22+
user_id = 100
23+
on_failure = [23456, 56788]
24+
on_cancel = [dbtcloud_job.prod_job.id]
25+
// the Type 4 is used for external notifications
26+
notification_type = 4
27+
// the external_email is the email address that will receive the notification
28+
external_email = "[email protected]"
2929
}
30+
31+
// and finally, we can set up Slack notifications
32+
resource "dbtcloud_notification" "prod_job_slack_notifications" {
33+
// we still need the ID of a user in dbt Cloud even though it is not used for sending notifications
34+
user_id = 100
35+
on_failure = [23456, 56788]
36+
on_cancel = [dbtcloud_job.prod_job.id]
37+
// the Type 2 is used for Slack notifications
38+
notification_type = 2
39+
slack_channel_id = "C12345ABCDE"
40+
slack_channel_name = "#my-awesome-channel"
41+
}

0 commit comments

Comments
 (0)