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

`terraform import dbt_cloud_project.*` deletes existing dbt Cloud configuration #111

Closed waligob closed 1 year ago

waligob commented 1 year ago

We have identified an issue with the dbt_cloud_project resource: running the import command terraform import dbt_cloud_project.<project_name> <project_id> deletes the existing project configuration. Here is the command run:

$ terraform import dbt_cloud_project.analytics 62160
var.dbt_cloud_api_key
  Enter a value: 

dbt_cloud_project.analytics: Importing from ID "62160"...
dbt_cloud_project.analytics: Import prepared!
  Prepared dbt_cloud_project for import
dbt_cloud_project.analytics: Refreshing state... [id=62160]

Import successful!

The resources that were imported are shown above. These resources are now in
your Terraform state and will henceforth be managed by Terraform.

After about 15 minutes, the configuration for an established project is no longer available: image _Note the project was named Analytics_old previously, but it was configured with a BigQuery connection, not Snowflake_

GtheSheep commented 1 year ago

Hi there! Could you elaborate a little more on this comment please, I'm not sure I quite understand? Note the project was named Analytics_old previously, but it was configured with a BigQuery connection, not Snowflake

Following on from this, did you run any further commands? Are any other resources managed in Terraform? Could you also let me know the provider version please. Has the issue repeated if you've tried it again at all? I did this on my own project with no worries and haven't been able to replicate this yet.

GtheSheep commented 1 year ago

Also, just to double check, your resource spec is something like:

resource "dbt_cloud_project" "analytics" {
  name = "Old Analytics Project Name"
}

?

waligob commented 1 year ago

Hi there! Could you elaborate a little more on this comment please, I'm not sure I quite understand? Note the project was named Analytics_old previously, but it was configured with a BigQuery connection, not Snowflake

Sure thing. What I meant to illustrate with that comment and sceenshot is that the command terraform import dbt_cloud_project.analytics 62160 appeared to delete our project Analytics_old (id 62160). The screenshot is meant to illustrate that our previously-established connection to BigQuery was no longer present (Snowflake appears to be the default warehouse when you create a new project).

The resource looked like the following:

resource "dbt_cloud_project" "analytics" {
  name = "Analytics_old"
}

And finally, we're on provider registry.terraform.io/gthesheep/dbt-cloud v0.1.4

github-actions[bot] commented 1 year 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.