From 40d8df9c8804e5a77f2eb10b18fea0f6a0139014 Mon Sep 17 00:00:00 2001 From: Samuel Mutel <12967891+smutel@users.noreply.github.com> Date: Fri, 20 Oct 2023 15:14:08 +0200 Subject: [PATCH] fix: Provider is crashing when insecure=true --- netbox/provider.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/netbox/provider.go b/netbox/provider.go index 6c31dda7b..9cd984633 100644 --- a/netbox/provider.go +++ b/netbox/provider.go @@ -2,6 +2,7 @@ package netbox import ( "context" + "crypto/tls" "fmt" "net/http" @@ -227,7 +228,7 @@ func configureProvider(ctx context.Context, d *schema.ResourceData) (interface{} t := runtimeclient.New(url, basepath, defaultScheme) if insecure { - t.Transport.(*http.Transport).TLSClientConfig.InsecureSkipVerify = insecure + t.Transport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: insecure} // #nosec G402 } t.DefaultAuthentication = runtimeclient.APIKeyAuth(authHeaderName, "header", fmt.Sprintf(authHeaderFormat, token))