You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
terraform/internal/pluginshared/cloudclient.go

35 lines
930 B

// Copyright IBM Corp. 2014, 2026
// SPDX-License-Identifier: BUSL-1.1
package pluginshared
import (
"context"
"net/url"
"github.com/hashicorp/go-retryablehttp"
"github.com/hashicorp/terraform/internal/httpclient"
"github.com/hashicorp/terraform/internal/logging"
)
// NewCloudPluginClient creates a new client for downloading and verifying
// terraform-cloudplugin archives
func NewCloudPluginClient(ctx context.Context, serviceURL *url.URL) (*BasePluginClient, error) {
httpClient := httpclient.New()
httpClient.Timeout = defaultRequestTimeout
retryableClient := retryablehttp.NewClient()
retryableClient.HTTPClient = httpClient
retryableClient.RetryMax = 3
retryableClient.RequestLogHook = requestLogHook
retryableClient.Logger = logging.HCLogger()
client := BasePluginClient{
ctx: ctx,
serviceURL: serviceURL,
httpClient: retryableClient,
pluginName: "cloudplugin",
}
return &client, nil
}