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

Provider Crashing on simple Terraform plan #106

Closed svenkerud closed 1 year ago

svenkerud commented 1 year ago

Hi, First off, thanks for creating this provider! It wil make my life a lot easier. Next, while I stardet to test out the provider, i ran into this issue. and it told me to report it, so i do that.

Something that might be of relevance, this occured during a Terraform Plan command Run terraform plan -input=false -no-color -out tf.plan -var-file=configuration.tfvars It has been run in a well established Deployment pipeline using an Azure backend for state storrage. I was able to get it working with a simple empty settup, just connecting to the backend.

Upon adding a project resource however it failed with the error below.

Stack trace from the terraform-provider-dbt-cloud_v0.1.5 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xa3a6c9]

goroutine 15 [running]:
github.com/gthesheep/terraform-provider-dbt-cloud/pkg/dbt_cloud.NewClient(0x0, 0x0, 0x0)
    github.com/gthesheep/terraform-provider-dbt-cloud/pkg/dbt_cloud/client.go:71 +0xa9
github.com/gthesheep/terraform-provider-dbt-cloud/pkg/provider.providerConfigure({0xbb7f40, 0x6}, 0xc000459c20)
    github.com/gthesheep/terraform-provider-dbt-cloud/pkg/provider/provider.go:87 +0x23f
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Provider).Configure(0xc0000aefc0, {0xcbc100, 0xc000459c20}, 0xd)
    github.com/hashicorp/terraform-plugin-sdk/v2@v2.12.0/helper/schema/provider.go:297 +0x23e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ConfigureProvider(0xc00032a330, {0xcbc058, 0xc0003e7100}, 0xc00000dc98)
    github.com/hashicorp/terraform-plugin-sdk/v2@v2.12.0/helper/schema/grpc_provider.go:557 +0x30d
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).Configure(0xc0001c06e0, {0xcbc100, 0xc000458ff0}, 0xc0003e6e80)
    github.com/hashicorp/terraform-plugin-go@v0.8.0/tfprotov5/tf5server/server.go:555 +0x32b
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_Configure_Handler({0xb8e7e0, 0xc0001c06e0}, {0xcbc100, 0xc000458ff0}, 0xc0003d9e00, 0x0)
    github.com/hashicorp/terraform-plugin-go@v0.8.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:331 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc00022e8c0, {0xcc8e38, 0xc000001860}, 0xc000406fc0, 0xc0003323f0, 0x1181958, 0x0)
    google.golang.org/grpc@v1.45.0/server.go:1[28](https://github.com/Storebrand-Technology-A-D/stb-damp-configuration/actions/runs/4043551080/jobs/6952602673#step:7:29)2 +0xccf
google.golang.org/grpc.(*Server).handleStream(0xc00022e8c0, {0xcc8e38, 0xc000001860}, 0xc000406fc0, 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 +0x[29](https://github.com/Storebrand-Technology-A-D/stb-damp-configuration/actions/runs/4043551080/jobs/6952602673#step:7:30)4

Error: The terraform-provider-dbt-cloud_v0.1.5 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.

I will carry on testing and trying to figure out if anythin happens on my end. However as I am not versed in GO, there is little I can do with the code to help debug it.

GtheSheep commented 1 year ago

hey! thanks for trying it out, could you let me know what type of resources/ datasources were in the non-empty plan? Also, if possible, could you try using v 1.4.0 and seeing if the issue was there? Would heftily narrow down the cause 😸 thanks!

svenkerud commented 1 year ago

The issue occured on 0.1.4. as vell. downgraded to se it was any different. The only recource was a project


resource "dbt_cloud_project" "projects" {
  name = "test"
}
svenkerud commented 1 year ago

Update, using a Enviroment rather than a project worked

GtheSheep commented 1 year ago

Interesting... will check it out, thanks!

svenkerud commented 1 year ago

Update: After taking out the project resource, and running it empty, followed by running it against an existing project with a Enviroment_variable resource it started working with projects as well.