From ff81bf738a67a298e517eff550cb954257359381 Mon Sep 17 00:00:00 2001 From: Manuel Ganter Date: Tue, 11 Nov 2025 15:55:38 +0100 Subject: [PATCH] fixed bug --- internal/provider/provider.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/internal/provider/provider.go b/internal/provider/provider.go index db60ef2..2e54f37 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -2,7 +2,9 @@ package provider import ( "context" + "net/http" "os" + "time" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/path" @@ -146,8 +148,17 @@ func (p *EdgeConnectProvider) Configure(ctx context.Context, req provider.Config tflog.Debug(ctx, "Creating Edge Connect client with username/password authentication") } - client := edgeclient.NewClient(endpoint) - + var client *edgeclient.Client + if token != "" { + client = edgeclient.NewClient(endpoint, + edgeclient.WithHTTPClient(&http.Client{Timeout: 30*time.Second}), + edgeclient.WithAuthProvider(edgeclient.NewStaticTokenProvider(token)), + ) + } else { + client = edgeclient.NewClientWithCredentials(endpoint, username, password, + edgeclient.WithHTTPClient(&http.Client{Timeout: 30*time.Second}), + ) + } // TODO: Configure client with authentication credentials // If using token: client.SetToken(token) // If using username/password: client.SetCredentials(username, password)