Skip to content

Commit dfdaee2

Browse files
authored
Merge pull request #196 from dbt-labs/release-0.2.9
Release 0.2.9
2 parents e9ca6cf + 599462e commit dfdaee2

24 files changed

+886
-11
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@
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.8...HEAD)
5+
## [Unreleased](https://github.com/dbt-labs/terraform-provider-dbtcloud/compare/v0.2.9...HEAD)
6+
7+
## [0.2.9](https://github.com/dbt-labs/terraform-provider-dbtcloud/compare/v0.2.8...v0.2.9)
8+
9+
## Changes
10+
11+
- Add support for extended attributes for environments [(docs)](https://docs.getdbt.com/docs/dbt-cloud-environments#extended-attributes-beta), allowing people to add connection attributes available in dbt-core but not in the dbt Cloud interface
12+
- [#191](https://github.com/dbt-labs/terraform-provider-dbtcloud/issues/191) - Allow setting a description for jobs
613

714
## [0.2.8](https://github.com/dbt-labs/terraform-provider-dbtcloud/compare/v0.2.7...v0.2.8)
815

docs/data-sources/environment.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ description: |-
2626
- `custom_branch` (String) Which custom branch to use in this environment
2727
- `dbt_version` (String) Version number of dbt to use in this environment, usually in the format 1.2.0-latest rather than core versions
2828
- `deployment_type` (String) The type of deployment environment (currently 'production' or empty)
29+
- `extended_attributes_id` (Number) The ID of the extended attributes applied
2930
- `id` (String) The ID of this resource.
3031
- `is_active` (Boolean) Whether the environment is active
3132
- `name` (String) Environment name
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "dbtcloud_extended_attributes Data Source - dbtcloud"
4+
subcategory: ""
5+
description: |-
6+
7+
---
8+
9+
# dbtcloud_extended_attributes (Data Source)
10+
11+
12+
13+
## Example Usage
14+
15+
```terraform
16+
data "dbtcloud_extended_attributes" "my_extended_attributes" {
17+
extended_attributes_id = 12345
18+
project_id = 6789
19+
}
20+
```
21+
22+
<!-- schema generated by tfplugindocs -->
23+
## Schema
24+
25+
### Required
26+
27+
- `extended_attributes_id` (Number) ID of the extended attributes
28+
- `project_id` (Number) Project ID the extended attributes refers to
29+
30+
### Read-Only
31+
32+
- `extended_attributes` (String) A JSON string listing the extended attributes mapping
33+
- `id` (String) The ID of this resource.
34+
- `state` (Number) The state of the extended attributes (1 = active, 2 = inactive)
35+
36+

docs/data-sources/job.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ description: |-
2424

2525
- `deferring_environment_id` (Number) ID of the environment this job defers to
2626
- `deferring_job_id` (Number) ID of the job this job defers to
27+
- `description` (String) Long description for the job
2728
- `environment_id` (Number) ID of the environment the job is in
2829
- `id` (String) The ID of this resource.
2930
- `name` (String) Given name for the job

docs/resources/environment.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ resource "dbtcloud_environment" "prod_environment" {
5151
- `credential_id` (Number) Credential ID to create the environment with. A credential is not required for development environments but is required for deployment environments
5252
- `custom_branch` (String) Which custom branch to use in this environment
5353
- `deployment_type` (String) The type of environment. Only valid for environments of type 'deployment' and for now can only be empty or set to 'production'
54+
- `extended_attributes_id` (Number) ID of the extended attributes for the environment
5455
- `is_active` (Boolean) Whether the environment is active
5556
- `use_custom_branch` (Boolean) Whether to use a custom git branch in this environment
5657

docs/resources/extended_attributes.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
page_title: "dbtcloud_extended_attributes Resource - dbtcloud"
3+
subcategory: ""
4+
description: |-
5+
This resource allows setting extended attributes which can be assigned to a given environment (see docs https://docs.getdbt.com/docs/dbt-cloud-environments#extended-attributes-beta).In dbt Cloud those values are provided as YML but in the provider they need to be provided as JSON (see example below).
6+
---
7+
8+
# dbtcloud_extended_attributes (Resource)
9+
10+
11+
This resource allows setting extended attributes which can be assigned to a given environment ([see docs](https://docs.getdbt.com/docs/dbt-cloud-environments#extended-attributes-beta)).<br/><br/>In dbt Cloud those values are provided as YML but in the provider they need to be provided as JSON (see example below).
12+
13+
## Example Usage
14+
15+
```terraform
16+
# extended_attributes can be set as a raw JSON string or encoded with Terraform's `jsonencode()` function
17+
# we recommend using `jsonencode()` to avoid Terraform reporting changes due to whitespaces or keys ordering
18+
resource "dbtcloud_extended_attributes" "my_attributes" {
19+
extended_attributes = jsonencode(
20+
{
21+
type = "databricks"
22+
catalog = "dbt_catalog"
23+
http_path = "/sql/your/http/path"
24+
my_nested_field = {
25+
subfield = "my_value"
26+
}
27+
}
28+
)
29+
project_id = var.dbt_project_id
30+
}
31+
32+
resource dbtcloud_environment issue_depl {
33+
dbt_version = "1.6.0-latest"
34+
name = "My environment"
35+
project_id = var.dbt_project_id
36+
type = "deployment"
37+
use_custom_branch = false
38+
credential_id = var.dbt_credential_id
39+
deployment_type = "production"
40+
extended_attributes_id = dbtcloud_extended_attributes.my_attributes.extended_attributes_id
41+
}
42+
```
43+
44+
<!-- schema generated by tfplugindocs -->
45+
## Schema
46+
47+
### Required
48+
49+
- `extended_attributes` (String) A JSON string listing the extended attributes mapping. The keys are the connections attributes available in the `profiles.yml` for a given adapter. Any fields entered will override connection details or credentials set on the environment or project. To avoid incorrect Terraform diffs, it is recommended to create this string using `jsonencode` in your Terraform code. (see example)
50+
- `project_id` (Number) Project ID to create the extended attributes in
51+
52+
### Optional
53+
54+
- `state` (Number) Extended Attributes state (1 is active, 2 is inactive)
55+
56+
### Read-Only
57+
58+
- `extended_attributes_id` (Number) Extended Attributes 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 extended attribute ID found in the URL or via the API.
67+
terraform import dbtcloud_extended_attributes.test_extended_attributes "project_id_id:extended_attributes_id"
68+
terraform import dbtcloud_extended_attributes.test_extended_attributes 12345:6789
69+
```

docs/resources/job.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ resource "dbtcloud_job" "test" {
5959
- `dbt_version` (String) Version number of dbt to use in this job, usually in the format 1.2.0-latest rather than core versions
6060
- `deferring_environment_id` (Number) Environment identifier that this job defers to (new deferring approach)
6161
- `deferring_job_id` (Number) Job identifier that this job defers to (legacy deferring approach)
62+
- `description` (String) Description for the job
6263
- `generate_docs` (Boolean) Flag for whether the job should generate documentation
6364
- `is_active` (Boolean) Flag for whether the job is marked active or deleted
6465
- `num_threads` (Number) Number of threads to use in the job
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
data "dbtcloud_extended_attributes" "my_extended_attributes" {
2+
extended_attributes_id = 12345
3+
project_id = 6789
4+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Import using a project ID and extended attribute ID found in the URL or via the API.
2+
terraform import dbtcloud_extended_attributes.test_extended_attributes "project_id_id:extended_attributes_id"
3+
terraform import dbtcloud_extended_attributes.test_extended_attributes 12345:6789
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# extended_attributes can be set as a raw JSON string or encoded with Terraform's `jsonencode()` function
2+
# we recommend using `jsonencode()` to avoid Terraform reporting changes due to whitespaces or keys ordering
3+
resource "dbtcloud_extended_attributes" "my_attributes" {
4+
extended_attributes = jsonencode(
5+
{
6+
type = "databricks"
7+
catalog = "dbt_catalog"
8+
http_path = "/sql/your/http/path"
9+
my_nested_field = {
10+
subfield = "my_value"
11+
}
12+
}
13+
)
14+
project_id = var.dbt_project_id
15+
}
16+
17+
resource dbtcloud_environment issue_depl {
18+
dbt_version = "1.6.0-latest"
19+
name = "My environment"
20+
project_id = var.dbt_project_id
21+
type = "deployment"
22+
use_custom_branch = false
23+
credential_id = var.dbt_credential_id
24+
deployment_type = "production"
25+
extended_attributes_id = dbtcloud_extended_attributes.my_attributes.extended_attributes_id
26+
}

0 commit comments

Comments
 (0)