Skip to content

Commit

Permalink
Merge pull request #253 from dbt-labs/release-0.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
b-per authored Apr 23, 2024
2 parents 40a0432 + d1a05de commit 50068f5
Show file tree
Hide file tree
Showing 46 changed files with 227 additions and 149 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,17 @@

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

## [Unreleased](https://github.com/dbt-labs/terraform-provider-dbtcloud/compare/v0.3.0...HEAD)
## [Unreleased](https://github.com/dbt-labs/terraform-provider-dbtcloud/compare/v0.3.1...HEAD)

## [0.3.1](https://github.com/dbt-labs/terraform-provider-dbtcloud/compare/v0.3.0...v0.3.1)

## Changes

- Add `on_merge` trigger for jobs. The trigger is optional for now but will be required in the future.

## Documentation

- Remove mention of `dbt_cloud_xxx` resources in the docs

## [0.3.0](https://github.com/dbt-labs/terraform-provider-dbtcloud/compare/v0.2.25...v0.3.0)

Expand Down
2 changes: 1 addition & 1 deletion docs/data-sources/job.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ description: |-
- `name` (String) Given name for the job
- `self_deferring` (Boolean) Whether this job defers on a previous run of itself (overrides value in deferring_job_id)
- `timeout_seconds` (Number) Number of seconds before the job times out
- `triggers` (Map of Boolean) Flags for which types of triggers to use, keys of github_webhook, git_provider_webhook, schedule, custom_branch_only
- `triggers` (Map of Boolean) Flags for which types of triggers to use, keys of github_webhook, git_provider_webhook, schedule, on_merge
- `triggers_on_draft_pr` (Boolean) Whether the CI job should be automatically triggered on draft PRs

<a id="nestedatt--job_completion_trigger_condition"></a>
Expand Down
4 changes: 0 additions & 4 deletions docs/resources/bigquery_connection.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ Resource to create BigQuery connections in dbt Cloud. Can be set to use OAuth fo
## Example Usage

```terraform
// NOTE for customers using the LEGACY dbt_cloud provider:
// use dbt_cloud_bigquery_connection instead of dbtcloud_bigquery_connection for the legacy resource names
// legacy names will be removed from 0.3 onwards
resource "dbtcloud_bigquery_connection" "my_connection" {
project_id = dbtcloud_project.dbt_project.id
name = "Project Name"
Expand Down
4 changes: 0 additions & 4 deletions docs/resources/bigquery_credential.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ description: |-
## Example Usage

```terraform
// NOTE for customers using the LEGACY dbt_cloud provider:
// use dbt_cloud_bigquery_credential instead of dbtcloud_bigquery_credential for the legacy resource names
// legacy names will be removed from 0.3 onwards
resource "dbtcloud_bigquery_credential" "my_credential" {
project_id = dbtcloud_project.dbt_project.id
dataset = "my_bq_dataset"
Expand Down
4 changes: 0 additions & 4 deletions docs/resources/connection.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ For BigQuery, due to the list of fields being very different, you can use the `d
## Example Usage

```terraform
// NOTE for customers using the LEGACY dbt_cloud provider:
// use dbt_cloud_connection instead of dbtcloud_connection for the legacy resource names
// legacy names will be removed from 0.3 onwards
resource "dbtcloud_connection" "databricks" {
project_id = dbtcloud_project.dbt_project.id
type = "adapter"
Expand Down
4 changes: 0 additions & 4 deletions docs/resources/databricks_credential.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ description: |-
## Example Usage

```terraform
// NOTE for customers using the LEGACY dbt_cloud provider:
// use dbt_cloud_databricks_credential instead of dbtcloud_databricks_credential for the legacy resource names
// legacy names will be removed from 0.3 onwards
# when using the Databricks adapter
resource "dbtcloud_databricks_credential" "my_databricks_cred" {
project_id = dbtcloud_project.dbt_project.id
Expand Down
4 changes: 0 additions & 4 deletions docs/resources/environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ description: |-
## Example Usage

```terraform
// NOTE for customers using the LEGACY dbt_cloud provider:
// use dbt_cloud_environment instead of dbtcloud_environment for the legacy resource names
// legacy names will be removed from 0.3 onwards
resource "dbtcloud_environment" "ci_environment" {
// the dbt_version is major.minor.0-latest , major.minor.0-pre or versionless (Beta on 15 Feb 2024, to always be on the latest dbt version)
dbt_version = "1.6.0-latest"
Expand Down
4 changes: 0 additions & 4 deletions docs/resources/environment_variable.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ the same time as the environment variables, it's recommended to use the `depends
## Example Usage

```terraform
// NOTE for customers using the LEGACY dbt_cloud provider:
// use dbt_cloud_environment_variable instead of dbtcloud_environment_variable for the legacy resource names
// legacy names will be removed from 0.3 onwards
resource "dbtcloud_environment_variable" "dbt_my_env_var" {
name = "DBT_MY_ENV_VAR"
project_id = dbtcloud_project.dbt_project.id
Expand Down
4 changes: 2 additions & 2 deletions docs/resources/extended_attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
page_title: "dbtcloud_extended_attributes Resource - dbtcloud"
subcategory: ""
description: |-
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).
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).In dbt Cloud those values are provided as YML but in the provider they need to be provided as JSON (see example below).
---

# dbtcloud_extended_attributes (Resource)


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).
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)).<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).

## Example Usage

Expand Down
4 changes: 0 additions & 4 deletions docs/resources/group.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ The mapping of permission names [from the docs](https://docs.getdbt.com/docs/clo
## Example Usage

```terraform
// NOTE for customers using the LEGACY dbt_cloud provider:
// use dbt_cloud_group instead of dbtcloud_group for the legacy resource names
// legacy names will be removed from 0.3 onwards
resource "dbtcloud_group" "tf_group_1" {
name = "TF Group 1"
group_permissions {
Expand Down
15 changes: 9 additions & 6 deletions docs/resources/job.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ description: |-

# dbtcloud_job (Resource)

~> As of October 2023, CI improvements have been rolled out to dbt Cloud with minor impacts to some jobs: [more info](https://docs.getdbt.com/docs/dbt-versions/release-notes/june-2023/ci-updates-phase1-rn).
~> In October 2023, CI improvements have been rolled out to dbt Cloud with minor impacts to some jobs: [more info](https://docs.getdbt.com/docs/dbt-versions/release-notes/june-2023/ci-updates-phase1-rn).
<br/>
<br/>
Those improvements include modifications to deferral which was historically set at the job level and will now be set at the environment level.
Deferral can still be set to "self" by setting `self_deferring` to `true` but with the new approach, deferral to other runs need to be done with `deferring_environment_id` instead of `deferring_job_id`.

~> New with 0.3.1, `triggers` now accepts a `on_merge` value to trigger jobs when code is merged in git. If `on_merge` is `true` all other triggers need to be `false`.
<br/>
<br/>
For now, it is not a mandatory field, but it will be in a future version. Please add `on_merge` in your config or modules.

## Example Usage

```terraform
// NOTE for customers using the LEGACY dbt_cloud provider:
// use dbt_cloud_job instead of dbtcloud_job for the legacy resource names
// legacy names will be removed from 0.3 onwards
# a job that has github_webhook and git_provider_webhook
# set to false will be categorized as a "Deploy Job"
resource "dbtcloud_job" "daily_job" {
Expand All @@ -39,6 +39,7 @@ resource "dbtcloud_job" "daily_job" {
"github_webhook" : false,
"git_provider_webhook" : false,
"schedule" : true
"on_merge" : false
}
# this is the default that gets set up when modifying jobs in the UI
schedule_days = [0, 1, 2, 3, 4, 5, 6]
Expand All @@ -64,6 +65,7 @@ resource "dbtcloud_job" "ci_job" {
"github_webhook" : true,
"git_provider_webhook" : true,
"schedule" : false
"on_merge" : false
}
# this is the default that gets set up when modifying jobs in the UI
# this is not going to be used when schedule is set to false
Expand All @@ -87,6 +89,7 @@ resource "dbtcloud_job" "downstream_job" {
"github_webhook" : false,
"git_provider_webhook" : false,
"schedule" : false
"on_merge" : false
}
schedule_days = [0, 1, 2, 3, 4, 5, 6]
schedule_type = "days_of_week"
Expand All @@ -107,7 +110,7 @@ resource "dbtcloud_job" "downstream_job" {
- `execute_steps` (List of String) List of commands to execute for the job
- `name` (String) Job name
- `project_id` (Number) Project ID to create the job in
- `triggers` (Map of Boolean) Flags for which types of triggers to use, the values are `github_webhook`, `git_provider_webhook`, and `schedule`. <br>`custom_branch_only` used to be allowed but has been deprecated from the API. The jobs will use the custom branch of the environment. Please remove the `custom_branch_only` from your config. <br>To create a job in a 'deactivated' state, set all to `false`.
- `triggers` (Map of Boolean) Flags for which types of triggers to use, the values are `github_webhook`, `git_provider_webhook`, `schedule` and `on_merge`. All flags should be listed and set with `true` or `false`. When `on_merge` is `true`, all the other values must be false.<br>`custom_branch_only` used to be allowed but has been deprecated from the API. The jobs will use the custom branch of the environment. Please remove the `custom_branch_only` from your config. <br>To create a job in a 'deactivated' state, set all to `false`.

### Optional

Expand Down
3 changes: 2 additions & 1 deletion docs/resources/notification.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ Setup notifications on jobs success/failure to internal users, external email ad

```terraform
// dbt Cloud allows us to create internal and external notifications
//
// an internal notification will send emails to the user mentioned in `user_id`
//
// NOTE: If internal notification settings already exist for a user, currently you MUST import
// those first into the state file before you can create a new internal notification for that user.
// Failure to do so, will result in the user losing access to existing notifications and dbt
// support will need to be contacted to restore access.
// cmd: terraform import dbtcloud_notification.prod_job_internal_notification <user_id>
resource "dbtcloud_notification" "prod_job_internal_notification" {
// user_id is the internal ID of a given user in dbt Cloud
user_id = 100
Expand Down
4 changes: 0 additions & 4 deletions docs/resources/postgres_credential.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ description: |-
## Example Usage

```terraform
// NOTE for customers using the LEGACY dbt_cloud provider:
// use dbt_cloud_postgres_credential instead of dbtcloud_postgres_credential for the legacy resource names
// legacy names will be removed from 0.3 onwards
resource "dbtcloud_postgres_credential" "postgres_prod_credential" {
is_active = true
project_id = dbtcloud_project.dbt_project.id
Expand Down
4 changes: 0 additions & 4 deletions docs/resources/project.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ description: |-
## Example Usage

```terraform
// NOTE for customers using the LEGACY dbt_cloud provider:
// use dbt_cloud_project instead of dbtcloud_project for the legacy resource names
// legacy names will be removed from 0.3 onwards
resource "dbtcloud_project" "dbt_project" {
name = "Analytics"
}
Expand Down
4 changes: 0 additions & 4 deletions docs/resources/project_artefacts.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ description: |-
## Example Usage

```terraform
// NOTE for customers using the LEGACY dbt_cloud provider:
// use dbt_cloud_project_artefacts instead of dbtcloud_project_artefacts for the legacy resource names
// legacy names will be removed from 0.3 onwards
resource "dbtcloud_project_artefacts" "my_project_artefacts" {
project_id = dbtcloud_project.dbt_project.id
docs_job_id = dbtcloud_job.prod_job.id
Expand Down
4 changes: 0 additions & 4 deletions docs/resources/project_connection.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ description: |-
## Example Usage

```terraform
// NOTE for customers using the LEGACY dbt_cloud provider:
// use dbt_cloud_project_connection instead of dbtcloud_project_connection for the legacy resource names
// legacy names will be removed from 0.3 onwards
resource "dbtcloud_project_connection" "dbt_project_connection" {
project_id = dbtcloud_project.dbt_project.id
connection_id = dbtcloud_connection.dbt_connection.connection_id
Expand Down
4 changes: 0 additions & 4 deletions docs/resources/project_repository.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ This resource allows you to link a dbt Cloud project to a git repository.
## Example Usage

```terraform
// NOTE for customers using the LEGACY dbt_cloud provider:
// use dbt_cloud_project_repository instead of dbtcloud_project_repository for the legacy resource names
// legacy names will be removed from 0.3 onwards
resource "dbtcloud_project_repository" "dbt_project_repository" {
project_id = dbtcloud_project.dbt_project.id
repository_id = dbtcloud_repository.dbt_repository.repository_id
Expand Down
5 changes: 0 additions & 5 deletions docs/resources/repository.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ value of `id` or use the `http` provider to retrieve it automatically like in t
## Example Usage

```terraform
// NOTE for customers using the LEGACY dbt_cloud provider:
// use dbt_cloud_repository instead of dbtcloud_repository for the legacy resource names
// legacy names will be removed from 0.3 onwards
### repo cloned via the GitHub integration, manually entering the `github_installation_id`
resource "dbtcloud_repository" "github_repo" {
project_id = dbtcloud_project.dbt_project.id
Expand Down
4 changes: 0 additions & 4 deletions docs/resources/service_token.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ The mapping of permission names [from the docs](https://docs.getdbt.com/docs/clo
## Example Usage

```terraform
// NOTE for customers using the LEGACY dbt_cloud provider:
// use dbt_cloud_service_token instead of dbtcloud_service_token for the legacy resource names
// legacy names will be removed from 0.3 onwards
resource "dbtcloud_service_token" "test_service_token" {
name = "Test Service Token"
service_token_permissions {
Expand Down
4 changes: 0 additions & 4 deletions docs/resources/snowflake_credential.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ description: |-
## Example Usage

```terraform
// NOTE for customers using the LEGACY dbt_cloud provider:
// use dbt_cloud_snowflake_credential instead of dbtcloud_snowflake_credential for the legacy resource names
// legacy names will be removed from 0.3 onwards
resource "dbtcloud_snowflake_credential" "prod_credential" {
project_id = data.dbtcloud_project.dbt_project.id
auth_type = "password"
Expand Down
4 changes: 0 additions & 4 deletions docs/resources/webhook.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ description: |-
## Example Usage

```terraform
// NOTE for customers using the LEGACY dbt_cloud provider:
// use dbt_cloud_webhook instead of dbtcloud_webhook for the legacy resource names
// legacy names will be removed from 0.3 onwards
resource "dbtcloud_webhook" "test_webhook" {
name = "test-webhook"
description = "Test webhook"
Expand Down
4 changes: 0 additions & 4 deletions examples/resources/dbtcloud_bigquery_connection/resource.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// NOTE for customers using the LEGACY dbt_cloud provider:
// use dbt_cloud_bigquery_connection instead of dbtcloud_bigquery_connection for the legacy resource names
// legacy names will be removed from 0.3 onwards

resource "dbtcloud_bigquery_connection" "my_connection" {
project_id = dbtcloud_project.dbt_project.id
name = "Project Name"
Expand Down
4 changes: 0 additions & 4 deletions examples/resources/dbtcloud_bigquery_credential/resource.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// NOTE for customers using the LEGACY dbt_cloud provider:
// use dbt_cloud_bigquery_credential instead of dbtcloud_bigquery_credential for the legacy resource names
// legacy names will be removed from 0.3 onwards

resource "dbtcloud_bigquery_credential" "my_credential" {
project_id = dbtcloud_project.dbt_project.id
dataset = "my_bq_dataset"
Expand Down
4 changes: 0 additions & 4 deletions examples/resources/dbtcloud_connection/resource.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// NOTE for customers using the LEGACY dbt_cloud provider:
// use dbt_cloud_connection instead of dbtcloud_connection for the legacy resource names
// legacy names will be removed from 0.3 onwards

resource "dbtcloud_connection" "databricks" {
project_id = dbtcloud_project.dbt_project.id
type = "adapter"
Expand Down
4 changes: 0 additions & 4 deletions examples/resources/dbtcloud_databricks_credential/resource.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// NOTE for customers using the LEGACY dbt_cloud provider:
// use dbt_cloud_databricks_credential instead of dbtcloud_databricks_credential for the legacy resource names
// legacy names will be removed from 0.3 onwards

# when using the Databricks adapter
resource "dbtcloud_databricks_credential" "my_databricks_cred" {
project_id = dbtcloud_project.dbt_project.id
Expand Down
4 changes: 0 additions & 4 deletions examples/resources/dbtcloud_environment/resource.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// NOTE for customers using the LEGACY dbt_cloud provider:
// use dbt_cloud_environment instead of dbtcloud_environment for the legacy resource names
// legacy names will be removed from 0.3 onwards

resource "dbtcloud_environment" "ci_environment" {
// the dbt_version is major.minor.0-latest , major.minor.0-pre or versionless (Beta on 15 Feb 2024, to always be on the latest dbt version)
dbt_version = "1.6.0-latest"
Expand Down
4 changes: 0 additions & 4 deletions examples/resources/dbtcloud_environment_variable/resource.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// NOTE for customers using the LEGACY dbt_cloud provider:
// use dbt_cloud_environment_variable instead of dbtcloud_environment_variable for the legacy resource names
// legacy names will be removed from 0.3 onwards

resource "dbtcloud_environment_variable" "dbt_my_env_var" {
name = "DBT_MY_ENV_VAR"
project_id = dbtcloud_project.dbt_project.id
Expand Down
4 changes: 0 additions & 4 deletions examples/resources/dbtcloud_group/resource.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// NOTE for customers using the LEGACY dbt_cloud provider:
// use dbt_cloud_group instead of dbtcloud_group for the legacy resource names
// legacy names will be removed from 0.3 onwards

resource "dbtcloud_group" "tf_group_1" {
name = "TF Group 1"
group_permissions {
Expand Down
7 changes: 3 additions & 4 deletions examples/resources/dbtcloud_job/resource.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// NOTE for customers using the LEGACY dbt_cloud provider:
// use dbt_cloud_job instead of dbtcloud_job for the legacy resource names
// legacy names will be removed from 0.3 onwards

# a job that has github_webhook and git_provider_webhook
# set to false will be categorized as a "Deploy Job"
resource "dbtcloud_job" "daily_job" {
Expand All @@ -20,6 +16,7 @@ resource "dbtcloud_job" "daily_job" {
"github_webhook" : false,
"git_provider_webhook" : false,
"schedule" : true
"on_merge" : false
}
# this is the default that gets set up when modifying jobs in the UI
schedule_days = [0, 1, 2, 3, 4, 5, 6]
Expand All @@ -45,6 +42,7 @@ resource "dbtcloud_job" "ci_job" {
"github_webhook" : true,
"git_provider_webhook" : true,
"schedule" : false
"on_merge" : false
}
# this is the default that gets set up when modifying jobs in the UI
# this is not going to be used when schedule is set to false
Expand All @@ -68,6 +66,7 @@ resource "dbtcloud_job" "downstream_job" {
"github_webhook" : false,
"git_provider_webhook" : false,
"schedule" : false
"on_merge" : false
}
schedule_days = [0, 1, 2, 3, 4, 5, 6]
schedule_type = "days_of_week"
Expand Down
3 changes: 2 additions & 1 deletion examples/resources/dbtcloud_notification/resource.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// dbt Cloud allows us to create internal and external notifications

//
// an internal notification will send emails to the user mentioned in `user_id`
//
// NOTE: If internal notification settings already exist for a user, currently you MUST import
// those first into the state file before you can create a new internal notification for that user.
// Failure to do so, will result in the user losing access to existing notifications and dbt
// support will need to be contacted to restore access.
// cmd: terraform import dbtcloud_notification.prod_job_internal_notification <user_id>

resource "dbtcloud_notification" "prod_job_internal_notification" {
// user_id is the internal ID of a given user in dbt Cloud
user_id = 100
Expand Down
Loading

0 comments on commit 50068f5

Please sign in to comment.