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 when use data source: okta_apps #2157

Closed
hixichen opened this issue Dec 6, 2024 · 1 comment · Fixed by #2159
Closed

Panic when use data source: okta_apps #2157

hixichen opened this issue Dec 6, 2024 · 1 comment · Fixed by #2159
Labels
bug triaged Triaged into internal Jira

Comments

@hixichen
Copy link

hixichen commented Dec 6, 2024

Configuration:



data "okta_apps" "active_apps" {
  active_only      = true
  use_optimization = true
}

version:

    okta = {
      source  = "okta/okta"
      version = "~> 4.12.0"
    }
    

try:
terraform plan -refresh=true -target='data.okta_apps.active_apps'

Log:

2024-12-06T10:38:25.922-0800 [DEBUG] provider.terraform-provider-okta_v4.12.0: -----------------------------------------------------
2024-12-06T10:38:25.922-0800 [DEBUG] provider.terraform-provider-okta_v4.12.0: panic: interface conversion: interface is nil, not okta.OktaApp
2024-12-06T10:38:25.922-0800 [DEBUG] provider.terraform-provider-okta_v4.12.0
2024-12-06T10:38:25.922-0800 [DEBUG] provider.terraform-provider-okta_v4.12.0: goroutine 113 [running]:
2024-12-06T10:38:25.923-0800 [DEBUG] provider.terraform-provider-okta_v4.12.0: github.com/okta/terraform-provider-okta/okta.(*AppsDataSource).Read(0x14000236010, {0x104bf2978, 0x140001db380}, {{{{0x104bf7ec0, 0x140002758c0}, {0x10489aa60, 0x14000274a50}}, {0x104bfad58, 0x140004b9b80}}, {{{0x0, ...}, ...}, ...}}, ...)
2024-12-06T10:38:25.923-0800 [DEBUG] provider.terraform-provider-okta_v4.12.0: 	github.com/okta/terraform-provider-okta/okta/data_source_okta_apps.go:176 +0x7e0
2024-12-06T10:38:25.923-0800 [DEBUG] provider.terraform-provider-okta_v4.12.0: github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).ReadDataSource(0x14000269380, {0x104bf2978, 0x140001db380}, 0x140001db410, 0x14000765568)
2024-12-06T10:38:25.923-0800 [DEBUG] provider.terraform-provider-okta_v4.12.0: 	github.com/hashicorp/[email protected]/internal/fwserver/server_readdatasource.go:79 +0x394
2024-12-06T10:38:25.923-0800 [DEBUG] provider.terraform-provider-okta_v4.12.0: github.com/hashicorp/terraform-plugin-framework/internal/proto6server.(*Server).ReadDataSource(0x14000269380, {0x104bf2978?, 0x140001db200?}, 0x140003fc1e0)
2024-12-06T10:38:25.923-0800 [DEBUG] provider.terraform-provider-okta_v4.12.0: 	github.com/hashicorp/[email protected]/internal/proto6server/server_readdatasource.go:55 +0x31c
2024-12-06T10:38:25.923-0800 [DEBUG] provider.terraform-provider-okta_v4.12.0: github.com/hashicorp/terraform-plugin-mux/tf6to5server.v6tov5Server.ReadDataSource({{0x104bfb5d8?, 0x14000269380?}}, {0x104bf2978?, 0x140001db200?}, 0x140003fc1c0?)
2024-12-06T10:38:25.923-0800 [DEBUG] provider.terraform-provider-okta_v4.12.0: 	github.com/hashicorp/[email protected]/tf6to5server/tf6to5server.go:227 +0x1f8
2024-12-06T10:38:25.923-0800 [DEBUG] provider.terraform-provider-okta_v4.12.0: github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(*muxServer).ReadDataSource(0x104bf29b0?, {0x104bf2978?, 0x140001daf00?}, 0x140003fc1c0)
2024-12-06T10:38:25.923-0800 [DEBUG] provider.terraform-provider-okta_v4.12.0: 	github.com/hashicorp/[email protected]/tf5muxserver/mux_server_ReadDataSource.go:36 +0x18c
2024-12-06T10:38:25.923-0800 [DEBUG] provider.terraform-provider-okta_v4.12.0: github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ReadDataSource(0x1400024ce60, {0x104bf2978?, 0x140001da2d0?}, 0x140004c8190)
2024-12-06T10:38:25.923-0800 [DEBUG] provider.terraform-provider-okta_v4.12.0: 	github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:686 +0x344
2024-12-06T10:38:25.923-0800 [DEBUG] provider.terraform-provider-okta_v4.12.0: github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadDataSource_Handler({0x104b24460?, 0x1400024ce60}, {0x104bf2978, 0x140001da2d0}, 0x140001ae800, 0x0)
2024-12-06T10:38:25.923-0800 [DEBUG] provider.terraform-provider-okta_v4.12.0: 	github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:572 +0x164
2024-12-06T10:38:25.923-0800 [DEBUG] provider.terraform-provider-okta_v4.12.0: google.golang.org/grpc.(*Server).processUnaryRPC(0x140001ab200, {0x104bf2978, 0x140001da240}, {0x104bf9138, 0x140001be180}, 0x14000114000, 0x1400048d800, 0x105aca980, 0x0)
2024-12-06T10:38:25.923-0800 [DEBUG] provider.terraform-provider-okta_v4.12.0: 	google.golang.org/[email protected]/server.go:1369 +0xba0
2024-12-06T10:38:25.923-0800 [DEBUG] provider.terraform-provider-okta_v4.12.0: google.golang.org/grpc.(*Server).handleStream(0x140001ab200, {0x104bf9138, 0x140001be180}, 0x14000114000)
2024-12-06T10:38:25.923-0800 [DEBUG] provider.terraform-provider-okta_v4.12.0: 	google.golang.org/[email protected]/server.go:1780 +0xc80
2024-12-06T10:38:25.923-0800 [DEBUG] provider.terraform-provider-okta_v4.12.0: google.golang.org/grpc.(*Server).serveStreams.func2.1()
2024-12-06T10:38:25.923-0800 [DEBUG] provider.terraform-provider-okta_v4.12.0: 	google.golang.org/[email protected]/server.go:1019 +0x8c
2024-12-06T10:38:25.923-0800 [DEBUG] provider.terraform-provider-okta_v4.12.0: created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 67
2024-12-06T10:38:25.923-0800 [DEBUG] provider.terraform-provider-okta_v4.12.0: 	google.golang.org/[email protected]/server.go:1030 +0x150
2024-12-06T10:38:25.927-0800 [ERROR] provider: plugin process exited: plugin=.terraform/providers/registry.terraform.io/okta/okta/4.12.0/darwin_arm64/terraform-provider-okta_v4.12.0 id=30629 error="exit status 2"
2024-12-06T10:38:25.927-0800 [ERROR] plugin.(*GRPCProvider).ReadDataSource: error="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-12-06T10:38:25.927-0800 [ERROR] vertex "data.okta_apps.active_apps" error: Plugin did not respond
2024-12-06T10:38:25.927-0800 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-12-06T10:38:25.927-0800 [ERROR] vertex "data.okta_apps.active_apps (expand)" error: Plugin did not respond
2024-12-06T10:38:25.943-0800 [WARN]  Planning encountered errors, so plan is not applyable
2024-12-06T10:38:25.943-0800 [INFO]  backend/local: plan operation completed

Planning failed. Terraform encountered an error while generating this plan.

╷
│ Warning: Resource targeting is in effect
│
│ You are creating a plan with the -target option, which means that the result of this plan may not represent all of the changes requested by the current configuration.
│
│ The -target option is not for routine use, and is provided only for exceptional situations such as recovering from errors or mistakes, or when Terraform specifically
│ suggests to use it as part of an error message.
╵
╷
│ Error: Plugin did not respond
│
│   with data.okta_apps.active_apps,
│   on group.tf line 60, in data "okta_apps" "active_apps":
│   60: data "okta_apps" "active_apps" {
│
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ReadDataSource call. The plugin logs may contain more details.
╵

Stack trace from the terraform-provider-okta_v4.12.0 plugin:

panic: interface conversion: interface is nil, not okta.OktaApp

goroutine 113 [running]:
github.com/okta/terraform-provider-okta/okta.(*AppsDataSource).Read(0x14000236010, {0x104bf2978, 0x140001db380}, {{{{0x104bf7ec0, 0x140002758c0}, {0x10489aa60, 0x14000274a50}}, {0x104bfad58, 0x140004b9b80}}, {{{0x0, ...}, ...}, ...}}, ...)
	github.com/okta/terraform-provider-okta/okta/data_source_okta_apps.go:176 +0x7e0
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).ReadDataSource(0x14000269380, {0x104bf2978, 0x140001db380}, 0x140001db410, 0x14000765568)
	github.com/hashicorp/[email protected]/internal/fwserver/server_readdatasource.go:79 +0x394
github.com/hashicorp/terraform-plugin-framework/internal/proto6server.(*Server).ReadDataSource(0x14000269380, {0x104bf2978?, 0x140001db200?}, 0x140003fc1e0)
	github.com/hashicorp/[email protected]/internal/proto6server/server_readdatasource.go:55 +0x31c
github.com/hashicorp/terraform-plugin-mux/tf6to5server.v6tov5Server.ReadDataSource({{0x104bfb5d8?, 0x14000269380?}}, {0x104bf2978?, 0x140001db200?}, 0x140003fc1c0?)
	github.com/hashicorp/[email protected]/tf6to5server/tf6to5server.go:227 +0x1f8
github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(*muxServer).ReadDataSource(0x104bf29b0?, {0x104bf2978?, 0x140001daf00?}, 0x140003fc1c0)
	github.com/hashicorp/[email protected]/tf5muxserver/mux_server_ReadDataSource.go:36 +0x18c
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ReadDataSource(0x1400024ce60, {0x104bf2978?, 0x140001da2d0?}, 0x140004c8190)
	github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:686 +0x344
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadDataSource_Handler({0x104b24460?, 0x1400024ce60}, {0x104bf2978, 0x140001da2d0}, 0x140001ae800, 0x0)
	github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:572 +0x164
google.golang.org/grpc.(*Server).processUnaryRPC(0x140001ab200, {0x104bf2978, 0x140001da240}, {0x104bf9138, 0x140001be180}, 0x14000114000, 0x1400048d800, 0x105aca980, 0x0)
	google.golang.org/[email protected]/server.go:1369 +0xba0
google.golang.org/grpc.(*Server).handleStream(0x140001ab200, {0x104bf9138, 0x140001be180}, 0x14000114000)
	google.golang.org/[email protected]/server.go:1780 +0xc80
google.golang.org/grpc.(*Server).serveStreams.func2.1()
	google.golang.org/[email protected]/server.go:1019 +0x8c
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 67
	google.golang.org/[email protected]/server.go:1030 +0x150

Error: The terraform-provider-okta_v4.12.0 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.

2024-12-06T10:38:26.019-0800 [DEBUG] provider: plugin exited
@hixichen hixichen changed the title Panic when use okta_apps.. Panic when use data source: okta_apps Dec 6, 2024
@hixichen
Copy link
Author

hixichen commented Dec 6, 2024

the debug logs show, it already got all the apps data, but type conversion failed due to nil value
https://github.com/okta/terraform-provider-okta/blob/master/okta/data_source_okta_apps.go#L176

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug triaged Triaged into internal Jira
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants