Skip to content

Commit 416d7fd

Browse files
authored
Merge pull request #206 from dbt-labs/fixes-example-problems
Fixes-example-problems
2 parents 3dc42c9 + 8547dca commit 416d7fd

File tree

45 files changed

+240
-144
lines changed

Some content is hidden

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

45 files changed

+240
-144
lines changed

docs/resources/bigquery_connection.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ Resource to create BigQuery connections in dbt Cloud. Can be set to use OAuth fo
1313
## Example Usage
1414

1515
```terraform
16+
// NOTE for customers using the LEGACY dbt_cloud provider:
1617
// use dbt_cloud_bigquery_connection instead of dbtcloud_bigquery_connection for the legacy resource names
1718
// legacy names will be removed from 0.3 onwards
1819
19-
resource "dbtcloud_bigquery_connection" "test_connection" {
20-
project_id = dbtcloud_project.test_project.id
20+
resource "dbtcloud_bigquery_connection" "my_connection" {
21+
project_id = dbtcloud_project.dbt_project.id
2122
name = "Project Name"
2223
type = "bigquery"
2324
is_active = true
@@ -35,8 +36,8 @@ resource "dbtcloud_bigquery_connection" "test_connection" {
3536
}
3637
3738
# it is also possible to set the connection to use OAuth by filling in `application_id` and `application_secret`
38-
resource "dbtcloud_bigquery_connection" "test_connection_with_oauth" {
39-
project_id = dbtcloud_project.test_project.id
39+
resource "dbtcloud_bigquery_connection" "my_connection_with_oauth" {
40+
project_id = dbtcloud_project.dbt_project.id
4041
name = "Project Name"
4142
type = "bigquery"
4243
is_active = true

docs/resources/bigquery_credential.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ description: |-
1313
## Example Usage
1414

1515
```terraform
16+
// NOTE for customers using the LEGACY dbt_cloud provider:
1617
// use dbt_cloud_bigquery_credential instead of dbtcloud_bigquery_credential for the legacy resource names
1718
// legacy names will be removed from 0.3 onwards
1819
19-
resource "dbtcloud_bigquery_credential" "test_credential" {
20-
project_id = dbtcloud_project.my_project.id
20+
resource "dbtcloud_bigquery_credential" "my_credential" {
21+
project_id = dbtcloud_project.dbt_project.id
2122
dataset = "my_bq_dataset"
2223
num_threads = 16
2324
}

docs/resources/connection.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ For BigQuery, due to the list of fields being very different, you can use the `d
1818
## Example Usage
1919

2020
```terraform
21+
// NOTE for customers using the LEGACY dbt_cloud provider:
2122
// use dbt_cloud_connection instead of dbtcloud_connection for the legacy resource names
2223
// legacy names will be removed from 0.3 onwards
2324
2425
resource "dbtcloud_connection" "databricks" {
25-
project_id = dbtcloud_project.my_project_1.id
26+
project_id = dbtcloud_project.dbt_project.id
2627
type = "adapter"
2728
name = "Databricks"
2829
database = "" // currenyly need to be empty for databricks
@@ -32,7 +33,7 @@ resource "dbtcloud_connection" "databricks" {
3233
}
3334
3435
resource "dbtcloud_connection" "redshift" {
35-
project_id = dbtcloud_project.my_project_2.id
36+
project_id = dbtcloud_project.dbt_project.id
3637
type = "redshift"
3738
name = "My Redshift Warehouse"
3839
database = "my-database"
@@ -41,7 +42,7 @@ resource "dbtcloud_connection" "redshift" {
4142
}
4243
4344
resource "dbtcloud_connection" "snowflake" {
44-
project_id = dbtcloud_project.my_project_3.id
45+
project_id = dbtcloud_project.dbt_project.id
4546
type = "snowflake"
4647
name = "My Snowflake warehouse"
4748
account = "my-snowflake-account"

docs/resources/databricks_credential.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ description: |-
1313
## Example Usage
1414

1515
```terraform
16+
// NOTE for customers using the LEGACY dbt_cloud provider:
1617
// use dbt_cloud_databricks_credential instead of dbtcloud_databricks_credential for the legacy resource names
1718
// legacy names will be removed from 0.3 onwards
1819
1920
# when using the Databricks adapter
20-
resource "dbtcloud_databricks_credential" "databricks_cred" {
21-
project_id = dbtcloud_project.my_project.id
21+
resource "dbtcloud_databricks_credential" "my_databricks_cred" {
22+
project_id = dbtcloud_project.dbt_project.id
2223
adapter_id = 123
2324
target_name = "prod"
2425
token = "abcdefgh"
@@ -27,8 +28,8 @@ resource "dbtcloud_databricks_credential" "databricks_cred" {
2728
}
2829
2930
# when using the Spark adapter
30-
resource "dbtcloud_databricks_credential" "spark_cred" {
31-
project_id = dbtcloud_project.my_other_project.id
31+
resource "dbtcloud_databricks_credential" "my_spark_cred" {
32+
project_id = dbtcloud_project.dbt_project.id
3233
adapter_id = 456
3334
target_name = "prod"
3435
token = "abcdefgh"
@@ -64,6 +65,6 @@ Import is supported using the following syntax:
6465

6566
```shell
6667
# Import using a project ID and credential ID found in the URL or via the API.
67-
terraform import dbtcloud_databricks_credential.test_databricks_credential "project_id:credential_id"
68-
terraform import dbtcloud_databricks_credential.test_databricks_credential 12345:6789
68+
terraform import dbtcloud_databricks_credential.my_databricks_credential "project_id:credential_id"
69+
terraform import dbtcloud_databricks_credential.my_databricks_credential 12345:6789
6970
```

docs/resources/environment.md

+19-10
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,36 @@ description: |-
1313
## Example Usage
1414

1515
```terraform
16+
// NOTE for customers using the LEGACY dbt_cloud provider:
1617
// use dbt_cloud_environment instead of dbtcloud_environment for the legacy resource names
1718
// legacy names will be removed from 0.3 onwards
1819
19-
resource "dbtcloud_environment" "test_environment" {
20+
resource "dbtcloud_environment" "ci_environment" {
2021
// the dbt_version is always major.minor.0-latest or major.minor.0-pre
21-
dbt_version = "1.5.0-latest"
22-
name = "test"
23-
project_id = data.dbtcloud_project.test_project.id
22+
dbt_version = "1.6.0-latest"
23+
name = "CI"
24+
project_id = dbtcloud_project.dbt_project.id
2425
type = "deployment"
25-
credential_id = dbt_cloud_snowflake_credential.new_credential.credential_id
26+
credential_id = dbtcloud_snowflake_credential.ci_credential.credential_id
2627
}
2728
2829
// we can also set a deployment environment as being the production one
2930
resource "dbtcloud_environment" "prod_environment" {
30-
dbt_version = "1.5.0-latest"
31+
dbt_version = "1.6.0-latest"
3132
name = "Prod"
32-
project_id = data.dbtcloud_project.test_project.id
33+
project_id = dbtcloud_project.dbt_project.id
3334
type = "deployment"
34-
credential_id = dbt_cloud_snowflake_credential.other_credential.credential_id
35+
credential_id = dbtcloud_snowflake_credential.prod_credential.credential_id
3536
deployment_type = "production"
3637
}
38+
39+
// Creating a development environment
40+
resource "dbtcloud_environment" "dev_environment" {
41+
dbt_version = "1.6.0-latest"
42+
name = "Dev"
43+
project_id = dbtcloud_project.dbt_project.id
44+
type = "development"
45+
}
3746
```
3847

3948
<!-- schema generated by tfplugindocs -->
@@ -66,6 +75,6 @@ Import is supported using the following syntax:
6675

6776
```shell
6877
# Import using a project ID and environment ID found in the URL or via the API.
69-
terraform import dbtcloud_environment.test_environment "project_id:environment_id"
70-
terraform import dbtcloud_environment.test_environment 12345:6789
78+
terraform import dbtcloud_environment.prod_environment "project_id:environment_id"
79+
terraform import dbtcloud_environment.prod_environment 12345:6789
7180
```

docs/resources/environment_variable.md

+10-5
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,24 @@ the same time as the environment variables, it's recommended to use the `depends
1313
## Example Usage
1414

1515
```terraform
16+
// NOTE for customers using the LEGACY dbt_cloud provider:
1617
// use dbt_cloud_environment_variable instead of dbtcloud_environment_variable for the legacy resource names
1718
// legacy names will be removed from 0.3 onwards
1819
19-
resource "dbtcloud_environment_variable" "my_env_var" {
20+
resource "dbtcloud_environment_variable" "dbt_my_env_var" {
2021
name = "DBT_MY_ENV_VAR"
21-
project_id = dbtcloud_project.my_project.id
22+
project_id = dbtcloud_project.dbt_project.id
2223
environment_values = {
2324
"project" : "my_project_level_value",
24-
"My Env" : "my_env_level_value"
25+
"Dev" : "my_env_level_value",
26+
"CI" : "my_ci_override_value",
27+
"Prod" "my_prod_override_value"
2528
}
2629
depends_on = [
27-
dbtcloud_project.my_project,
28-
dbtcloud_environment.my_env
30+
dbtcloud_project.dbt_project,
31+
dbtcloud_environment.dev_env,
32+
dbtcloud_environment.ci_env,
33+
dbtcloud_environment.prod_env,
2934
]
3035
}
3136
```

docs/resources/extended_attributes.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ resource "dbtcloud_extended_attributes" "my_attributes" {
2626
}
2727
}
2828
)
29-
project_id = var.dbt_project_id
29+
project_id = var.dbt_project.id
3030
}
3131
3232
resource dbtcloud_environment issue_depl {
3333
dbt_version = "1.6.0-latest"
3434
name = "My environment"
35-
project_id = var.dbt_project_id
35+
project_id = var.dbt_project.id
3636
type = "deployment"
3737
use_custom_branch = false
3838
credential_id = var.dbt_credential_id

docs/resources/group.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,20 @@ description: |-
1212
## Example Usage
1313

1414
```terraform
15+
// NOTE for customers using the LEGACY dbt_cloud provider:
1516
// use dbt_cloud_group instead of dbtcloud_group for the legacy resource names
1617
// legacy names will be removed from 0.3 onwards
1718
18-
resource "dbtcloud_group" "test_group" {
19-
name = "Test Group"
19+
resource "dbtcloud_group" "tf_group_1" {
20+
name = "TF Group 1"
2021
group_permissions {
2122
permission_set = "member"
2223
all_projects = true
2324
}
2425
group_permissions {
2526
permission_set = "developer"
2627
all_projects = false
27-
project_id = dbtcloud_project.test_project.id
28+
project_id = dbtcloud_project.dbt_project.id
2829
}
2930
}
3031
```

docs/resources/job.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,22 @@ Deferral can still be set to "self" by setting `self_deferring` to `true` but wi
1616
## Example Usage
1717

1818
```terraform
19+
// NOTE for customers using the LEGACY dbt_cloud provider:
1920
// use dbt_cloud_job instead of dbtcloud_job for the legacy resource names
2021
// legacy names will be removed from 0.3 onwards
2122
2223
# a job that has github_webhook and git_provider_webhook
2324
# set to false will be categorized as a "Deploy Job"
24-
resource "dbtcloud_job" "test" {
25-
environment_id = var.dbt_cloud_environment_id
25+
resource "dbtcloud_job" "daily_job" {
26+
environment_id = dbtcloud_environment.prod_environment.environment_id
2627
execute_steps = [
2728
"dbt build"
2829
]
2930
generate_docs = true
3031
is_active = true
3132
name = "Daily job"
3233
num_threads = 64
33-
project_id = data.dbtcloud_project.test_project.id
34+
project_id = dbtcloud_project.dbt_project.id
3435
run_generate_sources = true
3536
target_name = "default"
3637
triggers = {
@@ -49,15 +50,15 @@ resource "dbtcloud_job" "test" {
4950
# a job that has github_webhook and git_provider_webhook set
5051
# to true will be categorized as a "Continuous Integration Job"
5152
resource "dbtcloud_job" "ci_job" {
52-
environment_id = var.my_ci_environment_id
53+
environment_id = dbtcloud_environment.ci_environment.environment_id
5354
execute_steps = [
5455
"dbt build -s state:modified+ --fail-fast"
5556
]
5657
generate_docs = false
57-
deferring_environment_id = dbtcloud_environment.my_prod_env.environment_id
58+
deferring_environment_id = dbtcloud_environment.prod_environment.environment_id
5859
name = "CI Job"
5960
num_threads = 32
60-
project_id = data.dbtcloud_project.test_project.id
61+
project_id = dbtcloud_project.dbt_project.id
6162
run_generate_sources = false
6263
triggers = {
6364
"custom_branch_only" : true,

docs/resources/license_map.md

+15-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,22 @@ description: |-
1313
## Example Usage
1414

1515
```terraform
16-
resource "dbtcloud_license_map" "test_license_map" {
16+
# Developer license group mapping
17+
resource "dbtcloud_license_map" "dev_license_map" {
1718
license_type = "developer"
18-
sso_license_mapping_groups = ["TEST-GROUP"]
19+
sso_license_mapping_groups = ["DEV-SSO-GROUP"]
20+
}
21+
22+
# Read-only license mapping
23+
resource "dbtcloud_license_map" "read_only_license_map" {
24+
license_type = "read_only"
25+
sso_license_mapping_groups = ["READ-ONLY-SSO-GROUP"]
26+
}
27+
28+
# IT license mapping
29+
resource "dbtcloud_license_map" "it_license_map" {
30+
license_type = "it"
31+
sso_license_mapping_groups = ["IT-SSO-GROUP"]
1932
}
2033
```
2134

docs/resources/notification.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,27 @@ description: |-
1616
// dbt Cloud allows us to create internal and external notifications
1717
1818
// an internal notification will send emails to the user mentioned in `user_id`
19-
resource "dbtcloud_notification" "my_internal_notification" {
19+
//
20+
// NOTE: If internal notification settings already exist for a user, currently you MUST import
21+
// those first into the state file before you can create a new internal notification for that user.
22+
// Failure to do so, will result in the user losing access to existing notifications and dbt
23+
// support will need to be contacted to restore access.
24+
// cmd: terraform import dbtcloud_notification.prod_job_internal_notification <user_id>
25+
resource "dbtcloud_notification" "prod_job_internal_notification" {
2026
// user_id is the internal ID of a given user in dbt Cloud
2127
user_id = 100
22-
on_success = [dbtcloud_job.my_job.id]
28+
on_success = [dbtcloud_job.prod_job.id]
2329
on_failure = [12345]
2430
// the Type 1 is used for internal notifications
2531
notification_type = 1
2632
}
2733
2834
// we can also send "external" email notifications to emails to related to dbt Cloud users
29-
resource "dbtcloud_notification" "my_external_notification" {
35+
resource "dbtcloud_notification" "prod_job_external_notification" {
3036
// we still need the ID of a user in dbt Cloud even though it is not used for sending notifications
3137
user_id = 100
3238
on_failure = [23456, 56788]
33-
on_cancel = [dbtcloud_job.my_other_job.id]
39+
on_cancel = [dbtcloud_job.prod_job.id]
3440
// the Type 4 is used for external notifications
3541
notification_type = 4
3642
// the external_email is the email address that will receive the notification

docs/resources/postgres_credential.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ description: |-
1313
## Example Usage
1414

1515
```terraform
16+
// NOTE for customers using the LEGACY dbt_cloud provider:
1617
// use dbt_cloud_postgres_credential instead of dbtcloud_postgres_credential for the legacy resource names
1718
// legacy names will be removed from 0.3 onwards
1819
19-
resource "dbtcloud_postgres_credential" "test_credential" {
20+
resource "dbtcloud_postgres_credential" "postgres_prod_credential" {
2021
is_active = true
21-
project_id = dbtcloud_project.test_project.id
22+
project_id = dbtcloud_project.dbt_project.id
2223
type = "postgres"
2324
default_schema = "my_schema"
2425
username = "my_username"

docs/resources/project.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@ description: |-
1313
## Example Usage
1414

1515
```terraform
16+
// NOTE for customers using the LEGACY dbt_cloud provider:
1617
// use dbt_cloud_project instead of dbtcloud_project for the legacy resource names
1718
// legacy names will be removed from 0.3 onwards
1819
19-
resource "dbtcloud_project" "my_project" {
20+
resource "dbtcloud_project" "dbt_project" {
2021
name = "Analytics"
2122
}
2223
23-
resource "dbtcloud_project" "my_project_with_subdir" {
24+
resource "dbtcloud_project" "dbt_project_with_subdir" {
2425
name = "Analytics in Subdir"
2526
dbt_project_subdirectory = "/path"
2627
}

docs/resources/project_artefacts.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@ description: |-
1313
## Example Usage
1414

1515
```terraform
16+
// NOTE for customers using the LEGACY dbt_cloud provider:
1617
// use dbt_cloud_project_artefacts instead of dbtcloud_project_artefacts for the legacy resource names
1718
// legacy names will be removed from 0.3 onwards
1819
1920
resource "dbtcloud_project_artefacts" "my_project_artefacts" {
20-
project_id = dbtcloud_project.my_project.id
21-
docs_job_id = dbtcloud_job.my_job.id
22-
freshness_job_id = dbtcloud_job.my_job.id
21+
project_id = dbtcloud_project.dbt_project.id
22+
docs_job_id = dbtcloud_job.prod_job.id
23+
freshness_job_id = dbtcloud_job.prod_job.id
2324
}
2425
```
2526

0 commit comments

Comments
 (0)