deploymenttheory / terraform-provider-jamfpro

Jamf Pro Terraform Provider/Plugin written with the TF Provider SDK v2. Written in go
Mozilla Public License 2.0
22 stars 8 forks source link

Basic auth credentials make the plugin crash #312

Closed vbnin closed 2 days ago

vbnin commented 3 days ago

Following the 0.1.0 update, basic auth credentials make the provider plugin crash:

│ Error: Plugin did not respond
│ 
│   with provider["registry.terraform.io/deploymenttheory/jamfpro"],
│   on main.tf line 10, in provider "jamfpro":
│   10: provider "jamfpro" {
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ConfigureProvider call. The plugin logs may contain more details.
╵

Stack trace from the terraform-provider-jamfpro_v0.1.0 plugin:

panic: interface conversion: interface {} is nil, not string

goroutine 35 [running]:
github.com/deploymenttheory/terraform-provider-jamfpro/internal/provider.GetBasicAuthUsername(0x0?, 0x14000051168)
    github.com/deploymenttheory/terraform-provider-jamfpro/internal/provider/provider.go:167 +0x144
github.com/deploymenttheory/terraform-provider-jamfpro/internal/provider.Provider.func1({0x105629463?, 0x6?}, 0x140004ed400)
    github.com/deploymenttheory/terraform-provider-jamfpro/internal/provider/provider.go:447 +0x3c0
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Provider).Configure(0x140002e1500, {0x105aee1a0, 0x140005c3bf0}, 0x140004a1040)
    github.com/hashicorp/terraform-plugin-sdk/v2@v2.34.0/helper/schema/provider.go:369 +0x1d0
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ConfigureProvider(0x140003c6840, {0x105aee1a0?, 0x140005c3440?}, 0x140004c8680)
    github.com/hashicorp/terraform-plugin-sdk/v2@v2.34.0/helper/schema/grpc_provider.go:616 +0x368
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).Configure(0x140002cf5e0, {0x105aee1a0?, 0x140005c2a20?}, 0x140004a0dc0)
    github.com/hashicorp/terraform-plugin-go@v0.23.0/tfprotov5/tf5server/server.go:587 +0x2b8
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_Configure_Handler({0x105a9b4e0, 0x140002cf5e0}, {0x105aee1a0, 0x140005c2a20}, 0x140004ecc80, 0x0)
    github.com/hashicorp/terraform-plugin-go@v0.23.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:464 +0x1c0
google.golang.org/grpc.(*Server).processUnaryRPC(0x140001c7000, {0x105aee1a0, 0x1400046a390}, {0x105af4280, 0x140002b6d80}, 0x14000300120, 0x14000407680, 0x106367d50, 0x0)
    google.golang.org/grpc@v1.63.2/server.go:1369 +0xb58
google.golang.org/grpc.(*Server).handleStream(0x140001c7000, {0x105af4280, 0x140002b6d80}, 0x14000300120)
    google.golang.org/grpc@v1.63.2/server.go:1780 +0xb20
google.golang.org/grpc.(*Server).serveStreams.func2.1()
    google.golang.org/grpc@v1.63.2/server.go:1019 +0x8c
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 16
    google.golang.org/grpc@v1.63.2/server.go:1030 +0x13c

Error: The terraform-provider-jamfpro_v0.1.0 plugin crashed!

Only one main.tf file, here's its redacted config:

terraform {
  required_providers {
    jamfpro = {
      source  = "deploymenttheory/jamfpro"
      version = "0.1.0"
    }
  }
}

provider "jamfpro" {
  jamf_instance_fqdn                  = "https://vbnin.jamfcloud.com"
  auth_method                         = "basic"
  basic_auth_username                 = "USERNAME"
  basic_auth_password                 = "PASSWORD"
  log_level                           = "debug"
  token_refresh_buffer_period_seconds = 30
}

resource "jamfpro_category" "example_category_1" {
  name     = "tf-example-category-01"
  priority = 1
}

Expected results: A new category is created in Jamf Pro

Actual results: The terraform-provider-jamfpro_v0.1.0 plugin crashes

ShocOne commented 2 days ago

resolved in the newest release of the provider, thanks for raising it to our attention