Skip to content

Commit 8e4034d

Browse files
authored
Merge pull request #214 from dbt-labs/release-0.2.14
Release 0.2.14
2 parents 11e0782 + 51c34a8 commit 8e4034d

File tree

20 files changed

+705
-107
lines changed

20 files changed

+705
-107
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+8-7
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,21 @@ assignees: ''
77

88
---
99

10-
**Describe the bug**
10+
## Describe the bug
1111
A clear and concise description of what the bug is.
1212

13-
**Error message**
13+
## Error message
1414
The error message from running terraform.
1515

16-
**Resource configuration**
16+
## Resource configuration
1717
The relevant resource configuration (sanitised so it doesn't contain sensitive data)
1818

19-
**Expected behavior**
19+
## Expected behavior
2020
A clear and concise description of what you expected to happen.
2121

22-
**Config (please complete the following information):**
23-
- Provider version [e.g. 0.2.12]
22+
## Config (please complete the following information):
23+
( the version can be retrieved running the command `terraform providers` )
24+
- dbt Cloud provider version [e.g. 0.2.12]
2425

25-
**Additional context**
26+
## Additional context
2627
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/feature_request.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ assignees: ''
77

88
---
99

10-
**Is your feature request related to a problem? Please describe.**
10+
## Is your feature request related to a problem? Please describe.
1111
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
1212

13-
**Describe the solution you'd like**
13+
## Describe the solution you'd like
1414
A clear and concise description of what you want to happen.
1515

16-
**Describe alternatives you've considered**
16+
## Describe alternatives you've considered
1717
A clear and concise description of any alternative solutions or features you've considered.
1818

19-
**Additional context**
19+
## Additional context
2020
Add any other context or screenshots about the feature request here.

CHANGELOG.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,20 @@
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.13...HEAD)
5+
## [Unreleased](https://github.com/dbt-labs/terraform-provider-dbtcloud/compare/v0.2.14...HEAD)
6+
7+
## [0.2.14](https://github.com/dbt-labs/terraform-provider-dbtcloud/compare/v0.2.13...v0.2.14)
8+
9+
## Changes
10+
11+
- Fix issues with the repositories connected via GitLab native integration
12+
- Add ability to configure repositories using the native ADO integration
13+
- Add data sources for retrieving ADO projects and repositories ID and information
14+
15+
## Documentation
16+
17+
- Show in the main page that provider parameters can be set with env vars
18+
- Update examples and field descriptions for the repositories
619

720
## [0.2.13](https://github.com/dbt-labs/terraform-provider-dbtcloud/compare/v0.2.11...v0.2.13)
821

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "dbtcloud_azure_dev_ops_project Data Source - dbtcloud"
4+
subcategory: ""
5+
description: |-
6+
Use this data source to retrieve the ID of an Azure Dev Ops project
7+
based on its name.
8+
This data source requires connecting with a user token and doesn't work with a service token.
9+
---
10+
11+
# dbtcloud_azure_dev_ops_project (Data Source)
12+
13+
Use this data source to retrieve the ID of an Azure Dev Ops project
14+
based on its name.
15+
16+
This data source requires connecting with a user token and doesn't work with a service token.
17+
18+
## Example Usage
19+
20+
```terraform
21+
data "dbtcloud_azure_dev_ops_project" "my_ado_project" {
22+
name = "my-project-name"
23+
}
24+
```
25+
26+
<!-- schema generated by tfplugindocs -->
27+
## Schema
28+
29+
### Required
30+
31+
- `name` (String) The name of the ADO project
32+
33+
### Read-Only
34+
35+
- `id` (String) The internal Azure Dev Ops ID of the ADO Project
36+
- `url` (String) The URL of the ADO project
37+
38+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "dbtcloud_azure_dev_ops_repository Data Source - dbtcloud"
4+
subcategory: ""
5+
description: |-
6+
Use this data source to retrieve the ID and details of an Azure Dev Ops repository
7+
based on its name and the ID of the Azure Dev Ops project it belongs to.
8+
This data source requires connecting with a user token and doesn't work with a service token.
9+
---
10+
11+
# dbtcloud_azure_dev_ops_repository (Data Source)
12+
13+
Use this data source to retrieve the ID and details of an Azure Dev Ops repository
14+
based on its name and the ID of the Azure Dev Ops project it belongs to.
15+
16+
This data source requires connecting with a user token and doesn't work with a service token.
17+
18+
## Example Usage
19+
20+
```terraform
21+
data "dbtcloud_azure_dev_ops_repository" "my_ado_repository" {
22+
name = "my-repo-name"
23+
azure_dev_ops_project_id = data.dbtcloud_azure_dev_ops_project.my_ado_project.id
24+
}
25+
```
26+
27+
<!-- schema generated by tfplugindocs -->
28+
## Schema
29+
30+
### Required
31+
32+
- `azure_dev_ops_project_id` (String) The internal Azure Dev Ops ID of the ADO Project. Can be retrieved using the data source dbtcloud_azure_dev_ops_project and the project name
33+
- `name` (String) The name of the ADO repository
34+
35+
### Read-Only
36+
37+
- `default_branch` (String) The default branch of the ADO repository
38+
- `details_url` (String) The URL of the ADO repository showing details about the repository and its attributes
39+
- `id` (String) The internal Azure Dev Ops ID of the ADO Repository
40+
- `remote_url` (String) The HTTP URL of the ADO repository used to connect to dbt Cloud
41+
- `web_url` (String) The URL of the ADO repository accessible in the browser
42+
43+

docs/index.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ provider "dbt" {
7676

7777
### Required
7878

79-
- `account_id` (Number) Account identifier for your dbt Cloud implementation
80-
- `token` (String) API token for your dbt Cloud
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`
8181

8282
### Optional
8383

84-
- `host_url` (String) URL for your dbt Cloud deployment - Defaults to https://cloud.getdbt.com/api
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

docs/resources/repository.md

+30-10
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,17 @@ value of `id` or use the `http` provider to retrieve it automatically like in t
2828
// use dbt_cloud_repository instead of dbtcloud_repository for the legacy resource names
2929
// legacy names will be removed from 0.3 onwards
3030
31-
# repo cloned via the GitHub integration, manually entering the `github_installation_id`
31+
32+
### repo cloned via the GitHub integration, manually entering the `github_installation_id`
3233
resource "dbtcloud_repository" "github_repo" {
3334
project_id = dbtcloud_project.dbt_project.id
3435
remote_url = "[email protected]:<github_org>/<github_repo>.git"
3536
github_installation_id = 9876
3637
git_clone_strategy = "github_app"
3738
}
3839
39-
# repo cloned via the GitHub integration, with auto-retrieval of the `github_installation_id`
40+
41+
### repo cloned via the GitHub integration, with auto-retrieval of the `github_installation_id`
4042
# here, we assume that `token` and `host_url` are respectively accessible via `var.dbt_token` and `var.dbt_host_url`
4143
# NOTE: the following requires connecting via a user token and can't be retrieved with a service token
4244
data "http" "github_installations_response" {
@@ -58,21 +60,36 @@ resource "dbtcloud_repository" "github_repo_other" {
5860
}
5961
6062
61-
# repo cloned via the GitLab integration
62-
# as of 15 Sept 2023 this resource requires using a user token and can't be set with a service token
63+
### repo cloned via the GitLab integration
64+
# as of 15 Sept 2023 this resource requires using a user token and can't be set with a service token - CC-791
6365
resource "dbtcloud_repository" "gitlab_repo" {
6466
project_id = dbtcloud_project.dbt_project.id
6567
remote_url = "<gitlab-group>/<gitlab-project>"
6668
gitlab_project_id = 8765
6769
}
6870
6971
70-
# repo cloned via the deploy token strategy
72+
### repo cloned via the deploy token strategy
7173
resource "dbtcloud_repository" "deploy_repo" {
7274
project_id = dbtcloud_project.dbt_project.id
7375
remote_url = "git://github.com/<github_org>/<github_repo>.git"
7476
git_clone_strategy = "deploy_key"
7577
}
78+
79+
80+
### repo cloned via the Azure Dev Ops native integration
81+
resource "dbtcloud_repository" "ado_repo" {
82+
project_id = dbtcloud_project.dbt_project.id
83+
# the following values can be added manually (IDs can be retrieved from the ADO API) or via data sources
84+
# remote_url = "https://[email protected]/abc/def/_git/my_repo"
85+
# azure_active_directory_project_id = "12345678-1234-1234-1234-1234567890ab"
86+
# azure_active_directory_repository_id = "87654321-4321-abcd-abcd-464327678642"
87+
remote_url = data.dbtcloud_azure_dev_ops_repository.my_devops_repo.remote_url
88+
azure_active_directory_repository_id = data.dbtcloud_azure_dev_ops_repository.my_devops_repo.id
89+
azure_active_directory_project_id = data.dbtcloud_azure_dev_ops_project.my_devops_project.id
90+
azure_bypass_webhook_registration_failure = false
91+
git_clone_strategy = "azure_active_directory_app"
92+
}
7693
```
7794

7895
<!-- schema generated by tfplugindocs -->
@@ -85,17 +102,20 @@ resource "dbtcloud_repository" "deploy_repo" {
85102

86103
### Optional
87104

88-
- `fetch_deploy_key` (Boolean) Whether we should return the public deploy key
89-
- `git_clone_strategy` (String) Git clone strategy for the repository
90-
- `github_installation_id` (Number) Identifier for the GitHub App
91-
- `gitlab_project_id` (Number) Identifier for the Gitlab project
105+
- `azure_active_directory_project_id` (String) The Azure Dev Ops project ID. It can be retrieved via the Azure API or using the data source `dbtcloud_azure_dev_ops_project` and the project name - (for ADO native integration only)
106+
- `azure_active_directory_repository_id` (String) The Azure Dev Ops repository ID. It can be retrieved via the Azure API or using the data source `dbtcloud_azure_dev_ops_repository` along with the ADO Project ID and the repository name - (for ADO native integration only)
107+
- `azure_bypass_webhook_registration_failure` (Boolean) If set to False (the default), the connection will fail if the service user doesn't have access to set webhooks (required for auto-triggering CI jobs). If set to True, the connection will be successful but no automated CI job will be triggered - (for ADO native integration only)
108+
- `fetch_deploy_key` (Boolean) Whether we should return the public deploy key - (for the `deploy_key` strategy)
109+
- `git_clone_strategy` (String) Git clone strategy for the repository. Can be `deploy_key` (default) for cloning via SSH Deploy Key, `github_app` for GitHub native integration, `deploy_token` for the GitLab native integration and `azure_active_directory_app` for ADO native integration
110+
- `github_installation_id` (Number) Identifier for the GitHub App - (for GitHub native integration only)
111+
- `gitlab_project_id` (Number) Identifier for the Gitlab project - (for GitLab native integration only)
92112
- `is_active` (Boolean) Whether the repository is active
93-
- `repository_credentials_id` (Number) Credentials ID for the repository (From the repository side not the dbt Cloud ID)
94113

95114
### Read-Only
96115

97116
- `deploy_key` (String) Public key generated by dbt when using `deploy_key` clone strategy
98117
- `id` (String) The ID of this resource.
118+
- `repository_credentials_id` (Number) Credentials ID for the repository (From the repository side not the dbt Cloud ID)
99119
- `repository_id` (Number) Repository Identifier
100120

101121
## Import
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
data "dbtcloud_azure_dev_ops_project" "my_ado_project" {
2+
name = "my-project-name"
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
data "dbtcloud_azure_dev_ops_repository" "my_ado_repository" {
2+
name = "my-repo-name"
3+
azure_dev_ops_project_id = data.dbtcloud_azure_dev_ops_project.my_ado_project.id
4+
}

examples/resources/dbtcloud_repository/resource.tf

+22-5
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@
22
// use dbt_cloud_repository instead of dbtcloud_repository for the legacy resource names
33
// legacy names will be removed from 0.3 onwards
44

5-
# repo cloned via the GitHub integration, manually entering the `github_installation_id`
5+
6+
### repo cloned via the GitHub integration, manually entering the `github_installation_id`
67
resource "dbtcloud_repository" "github_repo" {
78
project_id = dbtcloud_project.dbt_project.id
89
remote_url = "[email protected]:<github_org>/<github_repo>.git"
910
github_installation_id = 9876
1011
git_clone_strategy = "github_app"
1112
}
1213

13-
# repo cloned via the GitHub integration, with auto-retrieval of the `github_installation_id`
14+
15+
### repo cloned via the GitHub integration, with auto-retrieval of the `github_installation_id`
1416
# here, we assume that `token` and `host_url` are respectively accessible via `var.dbt_token` and `var.dbt_host_url`
1517
# NOTE: the following requires connecting via a user token and can't be retrieved with a service token
1618
data "http" "github_installations_response" {
@@ -32,18 +34,33 @@ resource "dbtcloud_repository" "github_repo_other" {
3234
}
3335

3436

35-
# repo cloned via the GitLab integration
36-
# as of 15 Sept 2023 this resource requires using a user token and can't be set with a service token
37+
### repo cloned via the GitLab integration
38+
# as of 15 Sept 2023 this resource requires using a user token and can't be set with a service token - CC-791
3739
resource "dbtcloud_repository" "gitlab_repo" {
3840
project_id = dbtcloud_project.dbt_project.id
3941
remote_url = "<gitlab-group>/<gitlab-project>"
4042
gitlab_project_id = 8765
4143
}
4244

4345

44-
# repo cloned via the deploy token strategy
46+
### repo cloned via the deploy token strategy
4547
resource "dbtcloud_repository" "deploy_repo" {
4648
project_id = dbtcloud_project.dbt_project.id
4749
remote_url = "git://github.com/<github_org>/<github_repo>.git"
4850
git_clone_strategy = "deploy_key"
4951
}
52+
53+
54+
### repo cloned via the Azure Dev Ops integration
55+
resource "dbtcloud_repository" "ado_repo" {
56+
project_id = dbtcloud_project.dbt_project.id
57+
# the following values can be added manually (IDs can be retrieved from the ADO API) or via data sources
58+
# remote_url = "https://[email protected]/abc/def/_git/my_repo"
59+
# azure_active_directory_project_id = "12345678-1234-1234-1234-1234567890ab"
60+
# azure_active_directory_repository_id = "87654321-4321-abcd-abcd-464327678642"
61+
remote_url = data.dbtcloud_azure_dev_ops_repository.my_devops_repo.remote_url
62+
azure_active_directory_repository_id = data.dbtcloud_azure_dev_ops_repository.my_devops_repo.id
63+
azure_active_directory_project_id = data.dbtcloud_azure_dev_ops_project.my_devops_project.id
64+
azure_bypass_webhook_registration_failure = false
65+
git_clone_strategy = "azure_active_directory_app"
66+
}

examples/resources/dbtcloud_repository/subcat.txt

-1
This file was deleted.

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ go 1.17
44

55
require (
66
github.com/hashicorp/terraform-plugin-docs v0.13.0
7+
github.com/hashicorp/terraform-plugin-log v0.3.0
78
github.com/hashicorp/terraform-plugin-sdk/v2 v2.12.0
89
)
910

@@ -36,7 +37,6 @@ require (
3637
github.com/hashicorp/terraform-exec v0.17.2 // indirect
3738
github.com/hashicorp/terraform-json v0.14.0 // indirect
3839
github.com/hashicorp/terraform-plugin-go v0.8.0 // indirect
39-
github.com/hashicorp/terraform-plugin-log v0.3.0 // indirect
4040
github.com/hashicorp/terraform-registry-address v0.0.0-20210412075316-9b2996cce896 // indirect
4141
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect
4242
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect

0 commit comments

Comments
 (0)