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

panic: interface conversion: interface {} is nil, not map[string]interface {} #248

Open
srtab opened this issue Feb 27, 2024 · 5 comments
Open

Comments

@srtab
Copy link

srtab commented Feb 27, 2024

Terraform Version

Terraform v1.7.4
jdamata/sonarqube v0.16.10

Affected Resource(s)

  • sonarqube_project

Terraform Configuration Files

resource "sonarqube_project" "this" {
  name       = "project name"
  project    = "project-key"
  visibility = "private"

  setting {
    key    = "sonar.dbcleaner.branchesToKeepWhenInactive"
    values = ["master", "main", "release/*", "dev"]
  }
}

Expected Behavior

When I run a second terraform apply, I will see changes that will be applied.

Actual Behavior

I get the following error:

╷
│ Error: Plugin did not respond
│ 
│   with sonarqube_project.this,
│   on main.tf line 31, in resource "sonarqube_project" "this":31: resource "sonarqube_project" "this" {
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ReadResource call. The plugin logs may contain more details.
╵

Stack trace from the terraform-provider-sonarqube_v0.16.10 plugin:

panic: interface conversion: interface {} is nil, not map[string]interface {}

goroutine 273 [running]:
github.com/jdamata/terraform-provider-sonarqube/sonarqube.resourceSonarqubeProjectRead(0xc000814480, {0xb5f200?, 0xc0002f43c0})
        github.com/jdamata/terraform-provider-sonarqube/sonarqube/resource_sonarqube_project.go:235 +0xd2f
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0xdc3d00?, {0xdc3d00?, 0xc000260cf0?}, 0xd?, {0xb5f200?, 0xc0002f43c0?})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.28.0/helper/schema/resource.go:783 +0x178
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc0000b6e00, {0xdc3d00, 0xc000260cf0}, 0xc0001229c0, {0xb5f200, 0xc0002f43c0})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.28.0/helper/schema/resource.go:1089 +0x59e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0xc00000d890, {0xdc3d00?, 0xc000260bd0?}, 0xc000726240)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.28.0/helper/schema/grpc_provider.go:616 +0x497
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ReadResource(0xc0000b5220, {0xdc3d00?, 0xc0002603f0?}, 0xc00054c180)
        github.com/hashicorp/terraform-plugin-go@v0.18.0/tfprotov5/tf5server/server.go:751 +0x49e
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler({0xc5d7c0?, 0xc0000b5220}, {0xdc3d00, 0xc0002603f0}, 0xc0001ac0e0, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.18.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:386 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0000001e0, {0xdc6a60, 0xc0002969c0}, 0xc000262360, 0xc0003cff50, 0x12705b0, 0x0)
        google.golang.org/grpc@v1.56.3/server.go:1335 +0xde3
google.golang.org/grpc.(*Server).handleStream(0xc0000001e0, {0xdc6a60, 0xc0002969c0}, 0xc000262360, 0x0)
        google.golang.org/grpc@v1.56.3/server.go:1712 +0xa1b
google.golang.org/grpc.(*Server).serveStreams.func1.1()
        google.golang.org/grpc@v1.56.3/server.go:947 +0xca
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/grpc@v1.56.3/server.go:958 +0x15c

Error: The terraform-provider-sonarqube_v0.16.10 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.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply - This will run with no problems;
  2. terraform apply - Second run, will raise the traceback error.
@freeranger
Copy link
Collaborator

@srtab this problem doesn't happen with 0.16.9 - perhaps you could use that version for the moment?
@pnag90 This problem is with project creation and your changes for that went into 0.16.10 and seem to be the likely culprit: #202
Would you be able to take a look and fix the issue?

@freeranger
Copy link
Collaborator

@jdamata Would you be able to look at this issue caused by the @pnag90 change?
I haven't done any go in a long time and my knowledge is rapidly fading :(

@jdamata
Copy link
Owner

jdamata commented Oct 5, 2024

i cut out a new release with a hopeful fix. when v0.16.13 is released, can you give that a shot @srtab

@Bastian82
Copy link

Bastian82 commented Oct 14, 2024

i cut out a new release with a hopeful fix. when v0.16.13 is released, can you give that a shot @srtab

It seems it didnt help. Just to mention. I was able to create project but it crashed during second iteration of the run when project was already created and in resides in state.

`Stack trace from the terraform-provider-sonarqube_v0.16.13 plugin:

panic: interface conversion: interface {} is nil, not map[string]interface {}

goroutine 2299 [running]:
github.com/jdamata/terraform-provider-sonarqube/sonarqube.resourceSonarqubeProjectRead(0xc0000e0300, {0xb851c0, 0xc0002ea3c0})
github.com/jdamata/terraform-provider-sonarqube/sonarqube/resource_sonarqube_project.go:236 +0xd05
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0xdfa2b0?, {0xdfa2b0?, 0xc00047f050?}, 0xd?, {0xb851c0?, 0xc0002ea3c0?})
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:783 +0x15f
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc0000da7e0, {0xdfa2b0, 0xc00047f050}, 0xc0001df930, {0xb851c0, 0xc0002ea3c0})
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:1089 +0x529
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0xc000010240, {0xdfa2b0?, 0xc00047ef90?}, 0xc000696740)
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:616 +0x4aa
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ReadResource(0xc000404000, {0xdfa2b0?, 0xc00047e7e0?}, 0xc000a2a7e0)
github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:751 +0x488
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler({0xc95de0, 0xc000404000}, {0xdfa2b0, 0xc00047e7e0}, 0xc000258150, 0x0)
github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:386 +0x1a6
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0000e8000, {0xdfea00, 0xc000598000}, 0xc0005226c0, 0xc0000c3620, 0x1325c10, 0x0)
google.golang.org/[email protected]/server.go:1335 +0xdb8
google.golang.org/grpc.(*Server).handleStream(0xc0000e8000, {0xdfea00, 0xc000598000}, 0xc0005226c0, 0x0)
google.golang.org/[email protected]/server.go:1712 +0x9da
google.golang.org/grpc.(*Server).serveStreams.func1.1()
google.golang.org/[email protected]/server.go:947 +0xbb
created by google.golang.org/grpc.(*Server).serveStreams.func1 in goroutine 42
google.golang.org/[email protected]/server.go:958 +0x136

Error: The terraform-provider-sonarqube_v0.16.13 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.`

@freeranger
Copy link
Collaborator

Hopefully @jdamata can take a look at some point over the festive period :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants