dbt-labs / terraform-provider-dbtcloud

dbt Cloud Terraform Provider
https://registry.terraform.io/providers/dbt-labs/dbtcloud
MIT License
82 stars 19 forks source link

Issues when multiple repositories are defined for the same project_id #134

Closed b-per closed 11 months ago

b-per commented 1 year ago

A given project_id can only be assigned to one repository_id. But if we define 2 different dbt_clour_repository resources linked to the same project_id in our config, the state gets messed up.

e.g. with the following config

resource "dbt_cloud_repository" "repo1" {
  project_id  = 100
  remote_url = "git@myrepo.git"
  github_installation_id = 123456
  git_clone_strategy = "github_app"
}

resource "dbt_cloud_repository" "repo2" {
  project_id  = 100
  remote_url = "git@myrepo.git"
  git_clone_strategy = "deploy_token"
}

After a terraform apply, both dbt_cloud_repository.repo1 and dbt_cloud_repository.repo2 get assigned the same id and repository_id in the state, making following calls to terraform apply behave oddly and sometimes breaking the dbt Cloud config.

The immediate solution is to only have one single dbt_cloud_repository per project_id but the described behaviour makes me think that there might be ways to enhance/fix the code to avoid two resources to be given the same ids

github-actions[bot] commented 11 months ago

This issue has been marked as Stale because it has been open for 90 days with no activity. If you would like the issue to remain open, please comment on the issue or else it will be closed in 7 days.