smutel / terraform-provider-netbox

Terraform provider for Netbox
ISC License
58 stars 19 forks source link

When insecure=true, the provider registry.terraform.io/smutel/netbox failed #228

Closed draoullig closed 10 months ago

draoullig commented 10 months ago

Summary

panic: runtime error: invalid memory address or nil pointer dereference when insecure=true

Version

7.1.0

Netbox version

3.4.10

Terraform version

1.3.6

Provider version

v7.1.0

Issue details

Affected Data(s) / Resource(s)

Terraform Configuration Files

provider "netbox" {
 url  = "..."
 token   = ..."
 scheme = "https"
 insecure = true
}

Terraform Output

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

Behaviors

Actual Behavior

When insecure=true, the provider registry.terraform.io/smutel/netbox failed

Expected Behavior

If you change the line : t.Transport.(http.Transport).TLSClientConfig.InsecureSkipVerify = insecure by t.Transport.(http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: insecure} in provider.go The parameter insecure=true runs correctly

Steps to Reproduce

  1. Set insecure=true in the provider's parameters
  2. terraform plan