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: runtime error when saml app has no embed_url #1480

Closed
jon-parodi-yohana opened this issue Mar 7, 2023 · 1 comment · Fixed by #1482
Closed

panic: runtime error when saml app has no embed_url #1480

jon-parodi-yohana opened this issue Mar 7, 2023 · 1 comment · Fixed by #1482
Labels
bug panic Issue causes TF runtime to panic triaged Triaged into internal Jira

Comments

@jon-parodi-yohana
Copy link

When using the preconfigured saml app that has no associated embedded urls, provider crashes during future plans.
This is explicitly reproducible with the preconfigured app 'radius_generic_wifi' and was introduced in version 3.32
In versions 3.28-3.31 this error does not present itself.

Steps to reproduce:

resource "okta_app_saml" "radius_app" {
    accessibility_self_service = false
    app_settings_json          = jsonencode({})
    auto_submit_toolbar        = false
    hide_ios                   = false
    hide_web                   = false
    honor_force_authn          = false
    label                      = "hillview-wifi"
    preconfigured_app          = "radius_generic_app"
    saml_version               = "2.0"
    skip_groups                = false
    skip_users                 = false
    status                     = "ACTIVE"
}
resource "okta_group" "radius_role" {
       description = "hillview-wifi user role"
       name        = "app-hillview-wifi-user"
       skip_users  = false
}
resource "okta_app_group_assignment" "radius_group_assignment" {
       priority          = 1
       retain_assignment = false
       group_id = okta_group.radius_role.id
       app_id = okta_app_saml.radius_app.id
}

Stack trace:

panic: runtime error: index out of range [0] with length 0

goroutine 88 [running]:
github.com/okta/terraform-provider-okta/okta.linksValue({0x18c9800, 0xc00000db00}, {0xc000625200, 0x8, 0xffffffffffffff01})
        github.com/okta/terraform-provider-okta/okta/links.go:9 +0x175
github.com/okta/terraform-provider-okta/okta.linksValue({0x1917360, 0xc00083a870}, {0xc0006251f0, 0x2, 0x2})
        github.com/okta/terraform-provider-okta/okta/links.go:25 +0x145
github.com/okta/terraform-provider-okta/okta.resourceAppSamlRead({0x1b7a768, 0xc00080c7e0}, 0xc000399900, {0x1905920, 0xc0002c1680})
        github.com/okta/terraform-provider-okta/okta/resource_okta_app_saml.go:491 +0x5b8
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0xc000319b20, {0x1b7a7a0, 0xc00060e540}, 0xd, {0x1905920, 0xc0002c1680})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.19.0/helper/schema/resource.go:724 +0x12e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc000319b20, {0x1b7a7a0, 0xc00060e540}, 0xc000691110, {0x1905920, 0xc0002c1680})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.19.0/helper/schema/resource.go:1015 +0x585
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0xc0001282a0, {0x1b7a7a0, 0xc0003404b0}, 0xc0001b3180)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.19.0/helper/schema/grpc_provider.go:613 +0x574
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ReadResource(0xc0001a4320, {0x1b7a7a0, 0xc00025b830}, 0xc000306540)
        github.com/hashicorp/terraform-plugin-go@v0.12.0/tfprotov5/tf5server/server.go:747 +0x472
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler({0x19e47e0, 0xc0001a4320}, {0x1b7a7a0, 0xc00025b830}, 0xc000262070, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.12.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:349 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000326a80, {0x1b8ad60, 0xc00056e9c0}, 0xc000650360, 0xc00011f740, 0x215a050, 0x0)
        google.golang.org/grpc@v1.48.0/server.go:1295 +0xb03
google.golang.org/grpc.(*Server).handleStream(0xc000326a80, {0x1b8ad60, 0xc00056e9c0}, 0xc000650360, 0x0)
        google.golang.org/grpc@v1.48.0/server.go:1636 +0xa2a
google.golang.org/grpc.(*Server).serveStreams.func1.2()
        google.golang.org/grpc@v1.48.0/server.go:932 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/grpc@v1.48.0/server.go:930 +0x294

Error: The terraform-provider-okta_v3.32.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.

Failure appears to occur at

_ = d.Set("embed_url", linksValue(app.Links, "appLinks", "href"))
and crashes due to there being no links being provided and no logic to validate

@monde monde added panic Issue causes TF runtime to panic bug labels Mar 7, 2023
@monde
Copy link
Collaborator

monde commented Mar 7, 2023

Thanks @jon-parodi-yohana . I hate panics and this will be an easy fix.
Okta internal reference: https://oktainc.atlassian.net/browse/OKTA-585994

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

Successfully merging a pull request may close this issue.

2 participants