From ef41e7506e92acf8f8392f1650fca7ecd618f961 Mon Sep 17 00:00:00 2001 From: Sylvia Moss Date: Fri, 17 Dec 2021 17:59:46 +0100 Subject: [PATCH] add packer user agent to HCP client (#11455) --- internal/registry/client.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/registry/client.go b/internal/registry/client.go index 52ef5587425..51960fba90a 100644 --- a/internal/registry/client.go +++ b/internal/registry/client.go @@ -9,6 +9,7 @@ import ( rmmodels "github.com/hashicorp/hcp-sdk-go/clients/cloud-resource-manager/preview/2019-12-10/models" "github.com/hashicorp/hcp-sdk-go/httpclient" "github.com/hashicorp/packer/internal/registry/env" + "github.com/hashicorp/packer/version" ) // Client is an HCP client capable of making requests on behalf of a service principal @@ -35,7 +36,9 @@ func NewClient() (*Client, error) { } } - cl, err := httpclient.New(httpclient.Config{}) + cl, err := httpclient.New(httpclient.Config{ + SourceChannel: fmt.Sprintf("packer/%s", version.PackerVersion.FormattedVersion()), + }) if err != nil { return nil, &ClientError{ StatusCode: InvalidClientConfig,