Skip to content

Commit

Permalink
Merge pull request #229 from smutel/Fix228
Browse files Browse the repository at this point in the history
fix: Provider is crashing when insecure=true
  • Loading branch information
smutel authored Oct 20, 2023
2 parents eb3ee40 + 40d8df9 commit d8c3928
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion netbox/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package netbox

import (
"context"
"crypto/tls"
"fmt"
"net/http"

Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit d8c3928

Please sign in to comment.