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

issue when redeploying a dbt cloud job #141

Closed do-groupm closed 9 months ago

do-groupm commented 1 year ago

Stack trace from the terraform-provider-dbt-cloud_v0.1.9 plugin: panic: interface conversion: interface {} is nil, not bool goroutine 83 [running]: github.com/gthesheep/terraform-provider-dbt-cloud/pkg/resources.resourceJobUpdate({0xcd2088, 0xc000098f00}, 0xc000130880, {0xbc1340, 0xc00005e980}) github.com/gthesheep/terraform-provider-dbt-cloud/pkg/resources/job.go:353 +0x12c7 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).update(0xc0003d6c40, {0xcd20c0, 0xc00011f4a0}, 0xd, {0xbc1340, 0xc00005e980}) github.com/hashicorp/terraform-plugin-sdk/v2@v2.12.0/helper/schema/resource.go:376 +0x12e github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).Apply(0xc0003d6c40, {0xcd20c0, 0xc00011f4a0}, 0xc000377520, 0xc000130700, {0xbc1340, 0xc00005e980}) github.com/hashicorp/terraform-plugin-sdk/v2@v2.12.0/helper/schema/resource.go:482 +0x785 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(GRPCProviderServer).ApplyResourceChange(0xc000121140, {0xcd2018, 0xc00012ca40}, 0xc0005702d0) github.com/hashicorp/terraform-plugin-sdk/v2@v2.12.0/helper/schema/grpc_provider.go:1021 +0xdaa github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(server).ApplyResourceChange(0xc0003de0a0, {0xcd20c0, 0xc0001e9950}, 0xc0000f2d20) github.com/hashicorp/terraform-plugin-go@v0.8.0/tfprotov5/tf5server/server.go:812 +0x56b github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0xba1500, 0xc0003de0a0}, {0xcd20c0, 0xc0001e9950}, 0xc000589440, 0x0) github.com/hashicorp/terraform-plugin-go@v0.8.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:385 +0x170 google.golang.org/grpc.(Server).processUnaryRPC(0xc00014a700, {0xcdedf8, 0xc0004141a0}, 0xc000677c20, 0xc0003f0e70, 0x119db20, 0x0) google.golang.org/grpc@v1.45.0/server.go:1282 +0xccf google.golang.org/grpc.(Server).handleStream(0xc00014a700, {0xcdedf8, 0xc0004141a0}, 0xc000677c20, 0x0) google.golang.org/grpc@v1.45.0/server.go:1619 +0xa2a google.golang.org/grpc.(Server).serveStreams.func1.2() google.golang.org/grpc@v1.45.0/server.go:921 +0x98 created by google.golang.org/grpc.(Server).serveStreams.func1 google.golang.org/grpc@v1.45.0/server.go:919 +0x294 Error: The terraform-provider-dbt-cloud_v0.1.9 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely helpful if you could report the crash with the plugin's maintainers so that it can be fixed. The output above should help diagnose the issue.

GtheSheep commented 1 year ago

Hey, thanks for submitting!

Could you provide some details please, redeploying = updating? What did you change? What kind of configurations are on the job? Thanks

do-groupm commented 1 year ago

Running the first deployment for creating resources in DBT cloud, do work fine. However, every next time I need to do an update, although it does go through, it raises the issue mentioned above - resulting Terraform apply to fail.

It started only when introduced the following resource:

resource "dbt_cloud_job" "staging" {

  environment_id = dbt_cloud_environment.environments["prod"].environment_id
  execute_steps = [
    "dbt test"
  ]
  generate_docs = false
  is_active     = true
  name          = "Test"
  num_threads          = 4
  project_id           = dbt_cloud_project.unit.id
  run_generate_sources = false

  triggers = {
    "custom_branch_only" : false,
    "github_webhook" : false,
    "schedule" : false
  }

  timeout_seconds = 180

  depends_on = [dbt_cloud_project_repository.name]
}

Using the following version = "0.1.9"

Thanks

b-per commented 1 year ago

I saw this before and wanted to update the docs for it (it is part of the bigger docs PR), but I think the issue is that triggers also need an extra config.

Can you try adding git_provider_webhook ?

  triggers = {
    "custom_branch_only" : false,
    "git_provider_webhook" : false,
    "github_webhook" : false,
    "schedule" : false
  }
github-actions[bot] commented 10 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.