From dedc8c011db222733d61c137792c306206a9a836 Mon Sep 17 00:00:00 2001
From: Benoit Perigaud <8754100+b-per@users.noreply.github.com>
Date: Tue, 23 Apr 2024 11:32:22 +0200
Subject: [PATCH 1/4] Remove `dbt_cloud_xxx` docs
---
docs/resources/bigquery_connection.md | 4 ---
docs/resources/bigquery_credential.md | 4 ---
docs/resources/connection.md | 4 ---
docs/resources/databricks_credential.md | 4 ---
docs/resources/environment.md | 4 ---
docs/resources/environment_variable.md | 4 ---
docs/resources/extended_attributes.md | 4 +--
docs/resources/group.md | 4 ---
docs/resources/notification.md | 3 ++-
docs/resources/postgres_credential.md | 4 ---
docs/resources/project.md | 4 ---
docs/resources/project_artefacts.md | 4 ---
docs/resources/project_connection.md | 4 ---
docs/resources/project_repository.md | 4 ---
docs/resources/repository.md | 5 ----
docs/resources/service_token.md | 4 ---
docs/resources/snowflake_credential.md | 4 ---
docs/resources/webhook.md | 4 ---
.../dbtcloud_bigquery_connection/resource.tf | 4 ---
.../dbtcloud_bigquery_credential/resource.tf | 4 ---
.../resources/dbtcloud_connection/resource.tf | 4 ---
.../resource.tf | 4 ---
.../dbtcloud_environment/resource.tf | 4 ---
.../dbtcloud_environment_variable/resource.tf | 4 ---
examples/resources/dbtcloud_group/resource.tf | 4 ---
examples/resources/dbtcloud_job/resource.tf | 7 +++---
.../dbtcloud_notification/resource.tf | 3 ++-
.../dbtcloud_postgres_credential/resource.tf | 4 ---
.../resources/dbtcloud_project/resource.tf | 4 ---
.../dbtcloud_project_artefacts/resource.tf | 4 ---
.../dbtcloud_project_connection/resource.tf | 4 ---
.../dbtcloud_project_repository/resource.tf | 4 ---
.../resources/dbtcloud_repository/resource.tf | 4 ---
.../dbtcloud_service_token/resource.tf | 4 ---
.../dbtcloud_snowflake_credential/resource.tf | 4 ---
.../resources/dbtcloud_webhook/resource.tf | 4 ---
examples/resources/permissions.txt | 25 +++++++++++++++++++
pkg/sdkv2/resources/extended_attributes.go | 2 +-
38 files changed, 35 insertions(+), 138 deletions(-)
create mode 100644 examples/resources/permissions.txt
diff --git a/docs/resources/bigquery_connection.md b/docs/resources/bigquery_connection.md
index b4c7ab26..c3b9b051 100644
--- a/docs/resources/bigquery_connection.md
+++ b/docs/resources/bigquery_connection.md
@@ -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"
diff --git a/docs/resources/bigquery_credential.md b/docs/resources/bigquery_credential.md
index 5c154566..9efbef38 100644
--- a/docs/resources/bigquery_credential.md
+++ b/docs/resources/bigquery_credential.md
@@ -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"
diff --git a/docs/resources/connection.md b/docs/resources/connection.md
index f720c3f6..1808d447 100644
--- a/docs/resources/connection.md
+++ b/docs/resources/connection.md
@@ -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"
diff --git a/docs/resources/databricks_credential.md b/docs/resources/databricks_credential.md
index ac28f933..563e4a81 100644
--- a/docs/resources/databricks_credential.md
+++ b/docs/resources/databricks_credential.md
@@ -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
diff --git a/docs/resources/environment.md b/docs/resources/environment.md
index 9ffb9f43..ddb7fcfe 100644
--- a/docs/resources/environment.md
+++ b/docs/resources/environment.md
@@ -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"
diff --git a/docs/resources/environment_variable.md b/docs/resources/environment_variable.md
index 3626b4fb..b90a6f8c 100644
--- a/docs/resources/environment_variable.md
+++ b/docs/resources/environment_variable.md
@@ -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
diff --git a/docs/resources/extended_attributes.md b/docs/resources/extended_attributes.md
index b97c95d9..ddc22b6e 100644
--- a/docs/resources/extended_attributes.md
+++ b/docs/resources/extended_attributes.md
@@ -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)).
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).
## Example Usage
diff --git a/docs/resources/group.md b/docs/resources/group.md
index 1cc1ff77..8a518f88 100644
--- a/docs/resources/group.md
+++ b/docs/resources/group.md
@@ -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 {
diff --git a/docs/resources/notification.md b/docs/resources/notification.md
index 55ac5ba0..57499161 100644
--- a/docs/resources/notification.md
+++ b/docs/resources/notification.md
@@ -14,7 +14,7 @@ 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
@@ -22,6 +22,7 @@ Setup notifications on jobs success/failure to internal users, external email ad
// 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
+
resource "dbtcloud_notification" "prod_job_internal_notification" {
// user_id is the internal ID of a given user in dbt Cloud
user_id = 100
diff --git a/docs/resources/postgres_credential.md b/docs/resources/postgres_credential.md
index 16740339..8bd89aea 100644
--- a/docs/resources/postgres_credential.md
+++ b/docs/resources/postgres_credential.md
@@ -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
diff --git a/docs/resources/project.md b/docs/resources/project.md
index da958702..12967b8a 100644
--- a/docs/resources/project.md
+++ b/docs/resources/project.md
@@ -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"
}
diff --git a/docs/resources/project_artefacts.md b/docs/resources/project_artefacts.md
index 9d512db0..3ce67286 100644
--- a/docs/resources/project_artefacts.md
+++ b/docs/resources/project_artefacts.md
@@ -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
diff --git a/docs/resources/project_connection.md b/docs/resources/project_connection.md
index 542d87b1..d832f7f6 100644
--- a/docs/resources/project_connection.md
+++ b/docs/resources/project_connection.md
@@ -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
diff --git a/docs/resources/project_repository.md b/docs/resources/project_repository.md
index 4fcd0956..503b5a8d 100644
--- a/docs/resources/project_repository.md
+++ b/docs/resources/project_repository.md
@@ -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
diff --git a/docs/resources/repository.md b/docs/resources/repository.md
index f28f2c8e..0c0c7169 100644
--- a/docs/resources/repository.md
+++ b/docs/resources/repository.md
@@ -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
diff --git a/docs/resources/service_token.md b/docs/resources/service_token.md
index 2c0ae5f4..0b972ea3 100644
--- a/docs/resources/service_token.md
+++ b/docs/resources/service_token.md
@@ -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 {
diff --git a/docs/resources/snowflake_credential.md b/docs/resources/snowflake_credential.md
index cb6daae5..a234164a 100644
--- a/docs/resources/snowflake_credential.md
+++ b/docs/resources/snowflake_credential.md
@@ -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"
diff --git a/docs/resources/webhook.md b/docs/resources/webhook.md
index a32456d3..bf239fe5 100644
--- a/docs/resources/webhook.md
+++ b/docs/resources/webhook.md
@@ -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"
diff --git a/examples/resources/dbtcloud_bigquery_connection/resource.tf b/examples/resources/dbtcloud_bigquery_connection/resource.tf
index 4b577045..11d40b2d 100644
--- a/examples/resources/dbtcloud_bigquery_connection/resource.tf
+++ b/examples/resources/dbtcloud_bigquery_connection/resource.tf
@@ -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"
diff --git a/examples/resources/dbtcloud_bigquery_credential/resource.tf b/examples/resources/dbtcloud_bigquery_credential/resource.tf
index 463eed9f..5de23e03 100644
--- a/examples/resources/dbtcloud_bigquery_credential/resource.tf
+++ b/examples/resources/dbtcloud_bigquery_credential/resource.tf
@@ -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"
diff --git a/examples/resources/dbtcloud_connection/resource.tf b/examples/resources/dbtcloud_connection/resource.tf
index 2bd1fd3f..ac2cf840 100644
--- a/examples/resources/dbtcloud_connection/resource.tf
+++ b/examples/resources/dbtcloud_connection/resource.tf
@@ -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"
diff --git a/examples/resources/dbtcloud_databricks_credential/resource.tf b/examples/resources/dbtcloud_databricks_credential/resource.tf
index ead164b5..2643ed39 100644
--- a/examples/resources/dbtcloud_databricks_credential/resource.tf
+++ b/examples/resources/dbtcloud_databricks_credential/resource.tf
@@ -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
diff --git a/examples/resources/dbtcloud_environment/resource.tf b/examples/resources/dbtcloud_environment/resource.tf
index 61d4765c..1fc1d3d6 100644
--- a/examples/resources/dbtcloud_environment/resource.tf
+++ b/examples/resources/dbtcloud_environment/resource.tf
@@ -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"
diff --git a/examples/resources/dbtcloud_environment_variable/resource.tf b/examples/resources/dbtcloud_environment_variable/resource.tf
index 1d0bbb4b..6cb27606 100644
--- a/examples/resources/dbtcloud_environment_variable/resource.tf
+++ b/examples/resources/dbtcloud_environment_variable/resource.tf
@@ -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
diff --git a/examples/resources/dbtcloud_group/resource.tf b/examples/resources/dbtcloud_group/resource.tf
index e33f323b..caf6f70f 100644
--- a/examples/resources/dbtcloud_group/resource.tf
+++ b/examples/resources/dbtcloud_group/resource.tf
@@ -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 {
diff --git a/examples/resources/dbtcloud_job/resource.tf b/examples/resources/dbtcloud_job/resource.tf
index d457ee94..f8662331 100644
--- a/examples/resources/dbtcloud_job/resource.tf
+++ b/examples/resources/dbtcloud_job/resource.tf
@@ -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" {
@@ -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]
@@ -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
@@ -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"
diff --git a/examples/resources/dbtcloud_notification/resource.tf b/examples/resources/dbtcloud_notification/resource.tf
index 68035d39..36000bf2 100644
--- a/examples/resources/dbtcloud_notification/resource.tf
+++ b/examples/resources/dbtcloud_notification/resource.tf
@@ -1,5 +1,5 @@
// 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
@@ -7,6 +7,7 @@
// 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
+
resource "dbtcloud_notification" "prod_job_internal_notification" {
// user_id is the internal ID of a given user in dbt Cloud
user_id = 100
diff --git a/examples/resources/dbtcloud_postgres_credential/resource.tf b/examples/resources/dbtcloud_postgres_credential/resource.tf
index 4072c65a..fe53e4fd 100644
--- a/examples/resources/dbtcloud_postgres_credential/resource.tf
+++ b/examples/resources/dbtcloud_postgres_credential/resource.tf
@@ -1,7 +1,3 @@
-// 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
diff --git a/examples/resources/dbtcloud_project/resource.tf b/examples/resources/dbtcloud_project/resource.tf
index 73d6d351..822ce328 100644
--- a/examples/resources/dbtcloud_project/resource.tf
+++ b/examples/resources/dbtcloud_project/resource.tf
@@ -1,7 +1,3 @@
-// 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"
}
diff --git a/examples/resources/dbtcloud_project_artefacts/resource.tf b/examples/resources/dbtcloud_project_artefacts/resource.tf
index 5a3bfd85..0fc341e9 100644
--- a/examples/resources/dbtcloud_project_artefacts/resource.tf
+++ b/examples/resources/dbtcloud_project_artefacts/resource.tf
@@ -1,7 +1,3 @@
-// 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
diff --git a/examples/resources/dbtcloud_project_connection/resource.tf b/examples/resources/dbtcloud_project_connection/resource.tf
index 3beeeb75..9d10d8cc 100644
--- a/examples/resources/dbtcloud_project_connection/resource.tf
+++ b/examples/resources/dbtcloud_project_connection/resource.tf
@@ -1,7 +1,3 @@
-// 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
diff --git a/examples/resources/dbtcloud_project_repository/resource.tf b/examples/resources/dbtcloud_project_repository/resource.tf
index 2f4b229f..e1277482 100644
--- a/examples/resources/dbtcloud_project_repository/resource.tf
+++ b/examples/resources/dbtcloud_project_repository/resource.tf
@@ -1,7 +1,3 @@
-// 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
diff --git a/examples/resources/dbtcloud_repository/resource.tf b/examples/resources/dbtcloud_repository/resource.tf
index c8c6acaa..f95bd595 100644
--- a/examples/resources/dbtcloud_repository/resource.tf
+++ b/examples/resources/dbtcloud_repository/resource.tf
@@ -1,7 +1,3 @@
-// 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" {
diff --git a/examples/resources/dbtcloud_service_token/resource.tf b/examples/resources/dbtcloud_service_token/resource.tf
index 1882005e..7836e01b 100644
--- a/examples/resources/dbtcloud_service_token/resource.tf
+++ b/examples/resources/dbtcloud_service_token/resource.tf
@@ -1,7 +1,3 @@
-// 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 {
diff --git a/examples/resources/dbtcloud_snowflake_credential/resource.tf b/examples/resources/dbtcloud_snowflake_credential/resource.tf
index 05252236..0cf44291 100644
--- a/examples/resources/dbtcloud_snowflake_credential/resource.tf
+++ b/examples/resources/dbtcloud_snowflake_credential/resource.tf
@@ -1,7 +1,3 @@
-// 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"
diff --git a/examples/resources/dbtcloud_webhook/resource.tf b/examples/resources/dbtcloud_webhook/resource.tf
index 492fa07a..3dec8b71 100644
--- a/examples/resources/dbtcloud_webhook/resource.tf
+++ b/examples/resources/dbtcloud_webhook/resource.tf
@@ -1,7 +1,3 @@
-// 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"
diff --git a/examples/resources/permissions.txt b/examples/resources/permissions.txt
new file mode 100644
index 00000000..7da0204d
--- /dev/null
+++ b/examples/resources/permissions.txt
@@ -0,0 +1,25 @@
+<--beg-perm-->
+|Permission name......... | Permission code....|
+|-- | --|
+|Account Admin | account_admin|
+|Account Viewer | account_viewer|
+|Admin | admin|
+|Analyst | analyst|
+|Billing Admin | billing_admin|
+|Database Admin | database_admin|
+|Developer | developer|
+|Git Admin | git_admin|
+|Job Admin | job_admin|
+|Job Runner | job_runner|
+|Job Viewer | job_viewer|
+|Member | member|
+|Metadata Only | metadata_only|
+|Owner | owner|
+|Project Creator | project_creator|
+|Read-Only | readonly|
+|Security Admin | security_admin|
+|Semantic Layer Only | semantic_layer_only|
+|Stakeholder | stakeholder|
+|Team Admin | team_admin|
+|Webhooks Only | webhooks_only|
+<--end-perm-->
diff --git a/pkg/sdkv2/resources/extended_attributes.go b/pkg/sdkv2/resources/extended_attributes.go
index 0075be48..5824480f 100644
--- a/pkg/sdkv2/resources/extended_attributes.go
+++ b/pkg/sdkv2/resources/extended_attributes.go
@@ -58,7 +58,7 @@ func ResourceExtendedAttributes() *schema.Resource {
StateContext: schema.ImportStatePassthroughContext,
},
- 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).",
+ 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)).
In dbt Cloud those values are provided as YML but in the provider they need to be provided as JSON (see example below).",
}
}
From 196f08febf02c69b5549fc92fbc9282b45b18f39 Mon Sep 17 00:00:00 2001
From: Benoit Perigaud <8754100+b-per@users.noreply.github.com>
Date: Tue, 23 Apr 2024 11:32:49 +0200
Subject: [PATCH 2/4] Add `on_merge` trigger for jobs
---
pkg/dbt_cloud/job.go | 15 ++++
pkg/sdkv2/data_sources/job.go | 2 +-
pkg/sdkv2/resources/job.go | 53 +++++++++++-
pkg/sdkv2/resources/job_acceptance_test.go | 98 ++++++++++++++++++++++
templates/resources/job.md.tmpl | 6 +-
5 files changed, 171 insertions(+), 3 deletions(-)
diff --git a/pkg/dbt_cloud/job.go b/pkg/dbt_cloud/job.go
index 4c808356..96fa15af 100644
--- a/pkg/dbt_cloud/job.go
+++ b/pkg/dbt_cloud/job.go
@@ -12,6 +12,7 @@ type JobTrigger struct {
Github_Webhook bool `json:"github_webhook"`
Schedule bool `json:"schedule"`
GitProviderWebhook bool `json:"git_provider_webhook"`
+ OnMerge bool `json:"on_merge"`
}
type JobSettings struct {
@@ -65,6 +66,7 @@ type Job struct {
Description string `json:"description"`
Execute_Steps []string `json:"execute_steps"`
Dbt_Version *string `json:"dbt_version"`
+ JobType string `json:"job_type,omitempty"`
Triggers JobTrigger `json:"triggers"`
Settings JobSettings `json:"settings"`
State int `json:"state"`
@@ -131,6 +133,7 @@ func (c *Client) CreateJob(
if !isActive {
state = STATE_DELETED
}
+ jobType := ""
github_webhook, gw_found := triggers["github_webhook"]
if !gw_found {
github_webhook = false
@@ -139,14 +142,25 @@ func (c *Client) CreateJob(
if !s_found {
schedule = false
}
+ onMerge, s_found := triggers["on_merge"]
+ if !s_found {
+ onMerge = false
+ }
+ if onMerge.(bool) {
+ jobType = "merge"
+ }
git_provider_webhook, gpw_found := triggers["git_provider_webhook"]
if !gpw_found {
git_provider_webhook = false
}
+ if git_provider_webhook.(bool) {
+ jobType = "ci"
+ }
jobTriggers := JobTrigger{
Github_Webhook: github_webhook.(bool),
Schedule: schedule.(bool),
GitProviderWebhook: git_provider_webhook.(bool),
+ OnMerge: onMerge.(bool),
}
jobSettings := JobSettings{
Threads: numThreads,
@@ -212,6 +226,7 @@ func (c *Client) CreateJob(
Execution: jobExecution,
TriggersOnDraftPR: triggersOnDraftPR,
JobCompletionTrigger: jobCompletionTrigger,
+ JobType: jobType,
}
if dbtVersion != "" {
newJob.Dbt_Version = &dbtVersion
diff --git a/pkg/sdkv2/data_sources/job.go b/pkg/sdkv2/data_sources/job.go
index f6fefbea..0e7836c2 100644
--- a/pkg/sdkv2/data_sources/job.go
+++ b/pkg/sdkv2/data_sources/job.go
@@ -61,7 +61,7 @@ var jobSchema = map[string]*schema.Schema{
Optional: false,
Default: false,
},
- Description: "Flags for which types of triggers to use, keys of github_webhook, git_provider_webhook, schedule, custom_branch_only",
+ Description: "Flags for which types of triggers to use, keys of github_webhook, git_provider_webhook, schedule, on_merge",
},
"timeout_seconds": &schema.Schema{
Type: schema.TypeInt,
diff --git a/pkg/sdkv2/resources/job.go b/pkg/sdkv2/resources/job.go
index b01f2738..5d3b2407 100644
--- a/pkg/sdkv2/resources/job.go
+++ b/pkg/sdkv2/resources/job.go
@@ -10,6 +10,7 @@ import (
"github.com/dbt-labs/terraform-provider-dbtcloud/pkg/dbt_cloud"
"github.com/dbt-labs/terraform-provider-dbtcloud/pkg/utils"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
"github.com/samber/lo"
@@ -73,7 +74,7 @@ var jobSchema = map[string]*schema.Schema{
Optional: false,
Default: false,
},
- Description: "Flags for which types of triggers to use, the values are `github_webhook`, `git_provider_webhook`, and `schedule`.
`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.
To create a job in a 'deactivated' state, set all to `false`.",
+ Description: "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.
`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.
To create a job in a 'deactivated' state, set all to `false`.",
},
"num_threads": &schema.Schema{
Type: schema.TypeInt,
@@ -209,6 +210,43 @@ func ResourceJob() *schema.Resource {
Importer: &schema.ResourceImporter{
StateContext: schema.ImportStatePassthroughContext,
},
+
+ CustomizeDiff: customdiff.All(
+ // if we change the job type (CI, merge or "empty"), we need to recreate the job as dbt Cloud doesn't allow updating them
+ // the job type is determined by the triggers
+
+ func(ctx context.Context, d *schema.ResourceDiff, meta interface{}) error {
+ oldValue, newValue := d.GetChange("triggers")
+
+ oldValueMap := oldValue.(map[string]interface{})
+ newValueMap := newValue.(map[string]interface{})
+
+ oldCI, _ := oldValueMap["github_webhook"].(bool)
+ oldOnMerge, _ := oldValueMap["on_merge"].(bool)
+
+ oldType := ""
+ if oldCI {
+ oldType = "ci"
+ } else if oldOnMerge {
+ oldType = "merge"
+ }
+
+ newCI, _ := newValueMap["github_webhook"].(bool)
+ newOnMerge, _ := newValueMap["on_merge"].(bool)
+
+ newType := ""
+ if newCI {
+ newType = "ci"
+ } else if newOnMerge {
+ newType = "merge"
+ }
+
+ if oldType != newType {
+ d.ForceNew("triggers")
+ }
+ return nil
+ },
+ ),
}
}
@@ -312,6 +350,17 @@ func resourceJobRead(ctx context.Context, d *schema.ResourceData, m interface{})
triggers["custom_branch_only"] = listedCustomBranchOnly
}
+ // we remove triggers.on_merge if it is not set in the config and it is set to false in the remote
+ // that way it works if people don't define it, but also works to import jobs that have it set to true
+ // TODO: remove this when we make on_merge mandatory
+ _, ok = listedTriggers["on_merge"].(bool)
+ noOnMergeConfig := !ok
+ onMergeRemoteVal, _ := triggers["on_merge"].(bool)
+ onMergeRemoteFalse := !onMergeRemoteVal
+ if noOnMergeConfig && onMergeRemoteFalse {
+ delete(triggers, "on_merge")
+ }
+
if err := d.Set("triggers", triggers); err != nil {
return diag.FromErr(err)
}
@@ -531,6 +580,8 @@ func resourceJobUpdate(
if !ok {
return diag.FromErr(fmt.Errorf("schedule was not provided"))
}
+ job.Triggers.OnMerge, _ = newTriggers["on_merge"].(bool)
+ // should work without on_merge for now, so we don't need to test if it was provided
}
if d.HasChange("schedule_interval") {
diff --git a/pkg/sdkv2/resources/job_acceptance_test.go b/pkg/sdkv2/resources/job_acceptance_test.go
index e9e4307f..772c3c1f 100644
--- a/pkg/sdkv2/resources/job_acceptance_test.go
+++ b/pkg/sdkv2/resources/job_acceptance_test.go
@@ -189,6 +189,57 @@ func TestAccDbtCloudJobResource(t *testing.T) {
})
}
+func TestAccDbtCloudJobResourceTriggers(t *testing.T) {
+
+ jobName := strings.ToUpper(acctest.RandStringFromCharSet(10, acctest.CharSetAlpha))
+ projectName := strings.ToUpper(acctest.RandStringFromCharSet(10, acctest.CharSetAlpha))
+ environmentName := strings.ToUpper(acctest.RandStringFromCharSet(10, acctest.CharSetAlpha))
+
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ Providers: testAccProviders,
+ CheckDestroy: testAccCheckDbtCloudJobDestroy,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccDbtCloudJobResourceBasicConfigTriggers(
+ jobName,
+ projectName,
+ environmentName,
+ "git",
+ ),
+ Check: resource.ComposeTestCheckFunc(
+ testAccCheckDbtCloudJobExists("dbtcloud_job.test_job"),
+ resource.TestCheckResourceAttr("dbtcloud_job.test_job", "name", jobName),
+ ),
+ },
+ // MODIFY TRIGGERS
+ {
+ Config: testAccDbtCloudJobResourceBasicConfigTriggers(
+ jobName,
+ projectName,
+ environmentName,
+ "on_merge",
+ ),
+ Check: resource.ComposeTestCheckFunc(
+ testAccCheckDbtCloudJobExists("dbtcloud_job.test_job"),
+ resource.TestCheckResourceAttr("dbtcloud_job.test_job", "name", jobName),
+ ),
+ },
+ // IMPORT
+ {
+ ResourceName: "dbtcloud_job.test_job",
+ ImportState: true,
+ ImportStateVerify: true,
+ // we don't check triggers.on_merge as it is currently not enforced
+ ImportStateVerifyIgnore: []string{
+ // "triggers.%",
+ // "triggers.on_merge",
+ },
+ },
+ },
+ })
+}
+
func testAccDbtCloudJobResourceBasicConfig(jobName, projectName, environmentName string) string {
return fmt.Sprintf(`
resource "dbtcloud_project" "test_job_project" {
@@ -526,6 +577,53 @@ resource "dbtcloud_job" "test_job" {
`, projectName, environmentName, DBT_CLOUD_VERSION, jobName, scheduleConfig)
}
+func testAccDbtCloudJobResourceBasicConfigTriggers(
+ jobName, projectName, environmentName, trigger string,
+) string {
+
+ git_trigger := "false"
+ schedule_trigger := "false"
+ on_merge_trigger := "false"
+
+ if trigger == "git" {
+ git_trigger = "true"
+ }
+ if trigger == "schedule" {
+ schedule_trigger = "true"
+ }
+ if trigger == "on_merge" {
+ on_merge_trigger = "true"
+ }
+
+ return fmt.Sprintf(`
+resource "dbtcloud_project" "test_job_project" {
+ name = "%s"
+}
+
+resource "dbtcloud_environment" "test_job_environment" {
+ project_id = dbtcloud_project.test_job_project.id
+ name = "%s"
+ dbt_version = "%s"
+ type = "development"
+}
+
+resource "dbtcloud_job" "test_job" {
+ name = "%s"
+ project_id = dbtcloud_project.test_job_project.id
+ environment_id = dbtcloud_environment.test_job_environment.environment_id
+ execute_steps = [
+ "dbt test"
+ ]
+ triggers = {
+ "github_webhook": %s,
+ "git_provider_webhook": %s,
+ "schedule": %s,
+ "on_merge": %s
+ }
+}
+`, projectName, environmentName, DBT_CLOUD_VERSION, jobName, git_trigger, git_trigger, schedule_trigger, on_merge_trigger)
+}
+
func testAccCheckDbtCloudJobExists(resource string) resource.TestCheckFunc {
return func(state *terraform.State) error {
rs, ok := state.RootModule().Resources[resource]
diff --git a/templates/resources/job.md.tmpl b/templates/resources/job.md.tmpl
index bb728416..2f440878 100644
--- a/templates/resources/job.md.tmpl
+++ b/templates/resources/job.md.tmpl
@@ -7,12 +7,16 @@ description: |-
# {{.Name}} ({{.Type}})
-~> 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).
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`.
+
+
+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
From 7aa1e965c557e87d7d118c26b3a0eb7f11dc1333 Mon Sep 17 00:00:00 2001
From: Benoit Perigaud <8754100+b-per@users.noreply.github.com>
Date: Tue, 23 Apr 2024 11:33:53 +0200
Subject: [PATCH 3/4] Changelog for 0.3.1
---
CHANGELOG.md | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c92db0cb..4f6d4190 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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)
From d1a05dec0389ad314d305fb9aef2b1efa4ecd79e Mon Sep 17 00:00:00 2001
From: Benoit Perigaud <8754100+b-per@users.noreply.github.com>
Date: Tue, 23 Apr 2024 11:34:14 +0200
Subject: [PATCH 4/4] Updated docs for jobs with `on_merge`
---
docs/data-sources/job.md | 2 +-
docs/resources/job.md | 15 +++++++++------
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/docs/data-sources/job.md b/docs/data-sources/job.md
index 6d14b664..1f845117 100644
--- a/docs/data-sources/job.md
+++ b/docs/data-sources/job.md
@@ -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
diff --git a/docs/resources/job.md b/docs/resources/job.md
index b2cbba0b..3a33fb83 100644
--- a/docs/resources/job.md
+++ b/docs/resources/job.md
@@ -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).
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`.
+
+
+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" {
@@ -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]
@@ -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
@@ -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"
@@ -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`.
`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.
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.
`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.
To create a job in a 'deactivated' state, set all to `false`.
### Optional