Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: example - how to fail during apply when a service token is used… #244

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/resources/repository.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,22 @@ resource "dbtcloud_repository" "github_repo_other" {

### repo cloned via the GitLab integration
# as of 15 Sept 2023 this resource requires using a user token and can't be set with a service token - CC-791
# for better clarity, you can add a null_resource with precondition to throw an error during apply if the repository is created with a service token
resource "dbtcloud_repository" "gitlab_repo" {
project_id = dbtcloud_project.dbt_project.id
remote_url = "<gitlab-group>/<gitlab-project>"
gitlab_project_id = 8765
git_clone_strategy = "deploy_token"
}

resource "null_resource" "check_repository" {
lifecycle {
precondition {
condition = dbtcloud_repository.gitlab_repo.repository_credentials_id != 0
error_message = "Repositories created with a service token are currently not working properly (https://github.com/dbt-labs/terraform-provider-dbtcloud/issues/192)"
}
}
}

### repo cloned via the deploy token strategy
resource "dbtcloud_repository" "deploy_repo" {
Expand Down
9 changes: 9 additions & 0 deletions examples/resources/dbtcloud_repository/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,22 @@ resource "dbtcloud_repository" "github_repo_other" {

### repo cloned via the GitLab integration
# as of 15 Sept 2023 this resource requires using a user token and can't be set with a service token - CC-791
# for better clarity, you can add a null_resource with precondition to throw an error during apply if the repository is created with a service token
resource "dbtcloud_repository" "gitlab_repo" {
project_id = dbtcloud_project.dbt_project.id
remote_url = "<gitlab-group>/<gitlab-project>"
gitlab_project_id = 8765
git_clone_strategy = "deploy_token"
}

resource "null_resource" "check_repository" {
lifecycle {
precondition {
condition = dbtcloud_repository.gitlab_repo.repository_credentials_id != 0
error_message = "Repositories created with a service token are currently not working properly (https://github.com/dbt-labs/terraform-provider-dbtcloud/issues/192)"
}
}
}

### repo cloned via the deploy token strategy
resource "dbtcloud_repository" "deploy_repo" {
Expand Down
Loading