Skip to content

Commit 40a0432

Browse files
authored
Merge pull request #251 from dbt-labs/muxing-terraform-plugin-framework
2 parents 0f0fe0b + df18352 commit 40a0432

File tree

117 files changed

+1409
-872
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+1409
-872
lines changed

CHANGELOG.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@
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.25...HEAD)
5+
## [Unreleased](https://github.com/dbt-labs/terraform-provider-dbtcloud/compare/v0.3.0...HEAD)
6+
7+
## [0.3.0](https://github.com/dbt-labs/terraform-provider-dbtcloud/compare/v0.2.25...v0.3.0)
8+
9+
## Changes
10+
11+
- Implements muxing to allow both SDKv2 and Plugin Framework resources to work at the same time. This change a bit the internals but shouldn't have any regression.
12+
- Move some resources / datasources to the plugin Framework
13+
- Remove legacy `dbt_cloud_xxx` resources
614

715
## [0.2.25](https://github.com/dbt-labs/terraform-provider-dbtcloud/compare/v0.2.24...v0.2.25)
816

docs/data-sources/notification.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
page_title: "dbtcloud_notification Data Source - dbtcloud"
44
subcategory: ""
55
description: |-
6-
6+
Retrieve notification details
77
---
88

99
# dbtcloud_notification (Data Source)
1010

11-
11+
Retrieve notification details
1212

1313
## Example Usage
1414

@@ -23,14 +23,16 @@ data "dbtcloud_notification" "my_notification" {
2323

2424
### Required
2525

26-
- `notification_id` (Number) ID of the notification
26+
- `notification_id` (Number) The ID of the notification
2727

2828
### Read-Only
2929

3030
- `external_email` (String) The external email to receive the notification
31-
- `id` (String) The ID of this resource.
32-
- `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)
31+
- `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`)
3332
- `on_cancel` (Set of Number) List of job IDs to trigger the webhook on cancel
3433
- `on_failure` (Set of Number) List of job IDs to trigger the webhook on failure
3534
- `on_success` (Set of Number) List of job IDs to trigger the webhook on success
35+
- `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
36+
- `slack_channel_name` (String) The name of the slack channel
37+
- `state` (Number) State of the notification (1 = active (default), 2 = inactive)
3638
- `user_id` (Number) Internal dbt Cloud User ID. Must be the user_id for an existing user even if the notification is an external one

docs/data-sources/user.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
page_title: "dbtcloud_user Data Source - dbtcloud"
44
subcategory: ""
55
description: |-
6-
6+
Retrieve user details
77
---
88

99
# dbtcloud_user (Data Source)
1010

11-
11+
Retrieve user details
1212

1313
## Example Usage
1414

docs/index.md

+7-49
Original file line numberDiff line numberDiff line change
@@ -8,39 +8,19 @@ description: |-
88
# dbtcloud Provider
99

1010
~> 🚧 IMPORTANT! 🚧
11-
Since 0.2, resources and data sources are both available as `dbt_cloud_xxx` (legacy) and `dbtcloud_xxx` (following the Terraform convention).
12-
Selecting one option or the other is done by modifying the `required_providers` configuration.
11+
Since 0.3, only resources starting with `dbtcloud_xxx` are allowed. If you use the legacy `dbt_cloud_xxx` ones, you will have to stay on 0.2.x or move to the new resources.
12+
Instruction on how to do it is available in the 0.2.x docs.
1313

14-
- `dbt_cloud_xxx` is kept in 0.2 for backward compatibility, but will be removed from version 0.3 onwards. Consider starting new projects with the `dbtcloud_xxx` naming convention
15-
- `dbtcloud_xxx` follows the Terraform naming convention and is the long term convention for the dbt Cloud configuration
1614

17-
## Handling the move from `dbt_cloud_xxx` (legacy) to `dbtcloud_xxx`
1815

19-
As those are different resources, it is not possible to move existing resources using the `terraform state mv` command.
20-
21-
The options are:
22-
23-
- keep existing projects with `dbt_cloud_xxx` resources, and create new ones with `dbtcloud_xxx`
24-
- or update the state file manually to change the resource names (this should work but it is possible to corrupt the state, be careful and keep a backup)
25-
1. perform a `terraform apply` to apply the changes required to dbt Cloud
26-
1. edit the resource configuration files changing resources from `dbt_cloud_xxx` to `dbtcloud_xxx`
27-
1. edit `required_providers { dbt = {` and `provider "dbt"` to `required_providers { dbtcloud = {` and `provider "dbtcloud"`
28-
1. pull the remote state with `terraform state pull > remote_state.tfstate` and keep a back up of the file
29-
1. edit the state file to change the resource types from `dbt_cloud_xxx` to `dbtcloud_xxx`
30-
1. push the state back with `terraform state push remote_state.tfstate`
31-
1. perform a `terraform init -upgrade` to update the terraform provider
32-
1. perform a `terraform plan` to check that no change is required, you can then delete the backup of the state
33-
34-
35-
36-
## Recommended - Example with ``dbtcloud_xxx`` resources, using the `dbtcloud` provider name
16+
## Provider configuration
3717

3818
```terraform
3919
terraform {
4020
required_providers {
4121
dbtcloud = {
4222
source = "dbt-labs/dbtcloud"
43-
version = "0.2.0"
23+
version = "~> 0.3"
4424
}
4525
}
4626
}
@@ -52,33 +32,11 @@ provider "dbtcloud" {
5232
}
5333
```
5434

55-
## Legacy - Example with `dbt_cloud_xxx` resources, using the `dbt` provider name
56-
57-
```terraform
58-
terraform {
59-
required_providers {
60-
dbt = {
61-
source = "dbt-labs/dbtcloud"
62-
version = "0.2.0"
63-
}
64-
}
65-
}
66-
67-
provider "dbt" {
68-
account_id = var.dbt_cloud_account_id
69-
token = var.dbt_cloud_token
70-
host_url = "https://cloud.getdbt.com/api"
71-
}
72-
```
73-
7435
<!-- schema generated by tfplugindocs -->
7536
## Schema
7637

77-
### Required
78-
79-
- `account_id` (Number) Account identifier for your dbt Cloud implementation. Instead of setting the parameter, you can set the environment variable `DBT_CLOUD_ACCOUNT_ID`
80-
- `token` (String) API token for your dbt Cloud. Instead of setting the parameter, you can set the environment variable `DBT_CLOUD_TOKEN`
81-
8238
### Optional
8339

84-
- `host_url` (String) URL for your dbt Cloud deployment. Instead of setting the parameter, you can set the environment variable `DBT_CLOUD_HOST_URL` - Defaults to https://cloud.getdbt.com/api
40+
- `account_id` (Number) Account identifier for your dbt Cloud implementation. Instead of setting the parameter, you can set the environment variable `DBT_CLOUD_ACCOUNT_ID`
41+
- `host_url` (String) URL for your dbt Cloud deployment. Instead of setting the parameter, you can set the environment variable `DBT_CLOUD_HOST_URL` - Defaults to https://cloud.getdbt.com/api
42+
- `token` (String, Sensitive) API token for your dbt Cloud. Instead of setting the parameter, you can set the environment variable `DBT_CLOUD_TOKEN`

docs/resources/notification.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
page_title: "dbtcloud_notification Resource - dbtcloud"
33
subcategory: ""
44
description: |-
5-
5+
Setup notifications on jobs success/failure to internal users, external email addresses or Slack channels
66
---
77

88
# dbtcloud_notification (Resource)
99

1010

11-
11+
Setup notifications on jobs success/failure to internal users, external email addresses or Slack channels
1212

1313
## Example Usage
1414

@@ -76,7 +76,7 @@ resource "dbtcloud_notification" "prod_job_slack_notifications" {
7676

7777
### Read-Only
7878

79-
- `id` (String) The ID of this resource.
79+
- `id` (String) The ID of the notification
8080

8181
## Import
8282

examples/provider/provider.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
dbtcloud = {
44
source = "dbt-labs/dbtcloud"
5-
version = "0.2.0"
5+
version = "~> 0.3"
66
}
77
}
88
}

go.mod

+32-27
Original file line numberDiff line numberDiff line change
@@ -4,47 +4,51 @@ go 1.21
44

55
require (
66
github.com/hashicorp/terraform-plugin-docs v0.16.0
7+
github.com/hashicorp/terraform-plugin-framework v1.7.0
8+
github.com/hashicorp/terraform-plugin-framework-validators v0.12.0
9+
github.com/hashicorp/terraform-plugin-go v0.22.1
710
github.com/hashicorp/terraform-plugin-log v0.9.0
8-
github.com/hashicorp/terraform-plugin-sdk/v2 v2.30.0
11+
github.com/hashicorp/terraform-plugin-mux v0.15.0
12+
github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0
13+
github.com/hashicorp/terraform-plugin-testing v1.7.0
914
github.com/samber/lo v1.39.0
1015
)
1116

1217
require (
1318
github.com/Masterminds/goutils v1.1.1 // indirect
14-
github.com/Masterminds/semver/v3 v3.1.1 // indirect
15-
github.com/Masterminds/sprig/v3 v3.2.2 // indirect
16-
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect
19+
github.com/Masterminds/semver/v3 v3.2.0 // indirect
20+
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
21+
github.com/ProtonMail/go-crypto v1.1.0-alpha.0 // indirect
1722
github.com/agext/levenshtein v1.2.2 // indirect
1823
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
1924
github.com/armon/go-radix v1.0.0 // indirect
2025
github.com/bgentry/speakeasy v0.1.0 // indirect
2126
github.com/cloudflare/circl v1.3.7 // indirect
22-
github.com/fatih/color v1.13.0 // indirect
27+
github.com/fatih/color v1.16.0 // indirect
2328
github.com/golang/protobuf v1.5.3 // indirect
2429
github.com/google/go-cmp v0.6.0 // indirect
25-
github.com/google/uuid v1.3.0 // indirect
30+
github.com/google/uuid v1.6.0 // indirect
2631
github.com/hashicorp/errwrap v1.1.0 // indirect
2732
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
2833
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
2934
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect
30-
github.com/hashicorp/go-hclog v1.5.0 // indirect
35+
github.com/hashicorp/go-hclog v1.6.2 // indirect
3136
github.com/hashicorp/go-multierror v1.1.1 // indirect
32-
github.com/hashicorp/go-plugin v1.5.1 // indirect
37+
github.com/hashicorp/go-plugin v1.6.0 // indirect
3338
github.com/hashicorp/go-uuid v1.0.3 // indirect
3439
github.com/hashicorp/go-version v1.6.0 // indirect
35-
github.com/hashicorp/hc-install v0.6.1 // indirect
36-
github.com/hashicorp/hcl/v2 v2.19.1 // indirect
40+
github.com/hashicorp/hc-install v0.6.3 // indirect
41+
github.com/hashicorp/hcl/v2 v2.20.0 // indirect
3742
github.com/hashicorp/logutils v1.0.0 // indirect
38-
github.com/hashicorp/terraform-exec v0.19.0 // indirect
39-
github.com/hashicorp/terraform-json v0.17.1 // indirect
40-
github.com/hashicorp/terraform-plugin-go v0.19.0 // indirect
41-
github.com/hashicorp/terraform-registry-address v0.2.2 // indirect
43+
github.com/hashicorp/terraform-exec v0.20.0 // indirect
44+
github.com/hashicorp/terraform-json v0.21.0 // indirect
45+
github.com/hashicorp/terraform-registry-address v0.2.3 // indirect
4246
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
43-
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
44-
github.com/huandu/xstrings v1.3.2 // indirect
47+
github.com/hashicorp/yamux v0.1.1 // indirect
48+
github.com/huandu/xstrings v1.3.3 // indirect
4549
github.com/imdario/mergo v0.3.15 // indirect
4650
github.com/mattn/go-colorable v0.1.13 // indirect
47-
github.com/mattn/go-isatty v0.0.16 // indirect
51+
github.com/mattn/go-isatty v0.0.20 // indirect
4852
github.com/mitchellh/cli v1.1.5 // indirect
4953
github.com/mitchellh/copystructure v1.2.0 // indirect
5054
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
@@ -57,17 +61,18 @@ require (
5761
github.com/shopspring/decimal v1.3.1 // indirect
5862
github.com/spf13/cast v1.5.0 // indirect
5963
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
60-
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
64+
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
6165
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
62-
github.com/zclconf/go-cty v1.14.1 // indirect
63-
golang.org/x/crypto v0.17.0 // indirect
66+
github.com/zclconf/go-cty v1.14.3 // indirect
67+
golang.org/x/crypto v0.21.0 // indirect
6468
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect
65-
golang.org/x/mod v0.13.0 // indirect
66-
golang.org/x/net v0.17.0 // indirect
67-
golang.org/x/sys v0.15.0 // indirect
69+
golang.org/x/mod v0.15.0 // indirect
70+
golang.org/x/net v0.21.0 // indirect
71+
golang.org/x/sys v0.18.0 // indirect
6872
golang.org/x/text v0.14.0 // indirect
69-
google.golang.org/appengine v1.6.7 // indirect
70-
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect
71-
google.golang.org/grpc v1.57.1 // indirect
72-
google.golang.org/protobuf v1.31.0 // indirect
73+
golang.org/x/tools v0.13.0 // indirect
74+
google.golang.org/appengine v1.6.8 // indirect
75+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect
76+
google.golang.org/grpc v1.62.1 // indirect
77+
google.golang.org/protobuf v1.33.0 // indirect
7378
)

0 commit comments

Comments
 (0)