Update user-agent from go-tfe to opentofu where go-tfe is used (#807)

This commit is contained in:
Igor Savchenko
2023-11-02 04:11:13 -07:00
committed by GitHub
parent a1e110c679
commit 572d8d95d1
3 changed files with 13 additions and 0 deletions

View File

@@ -28,6 +28,7 @@ import (
"github.com/opentofu/opentofu/internal/backend"
"github.com/opentofu/opentofu/internal/command/jsonformat"
"github.com/opentofu/opentofu/internal/configs/configschema"
"github.com/opentofu/opentofu/internal/httpclient"
"github.com/opentofu/opentofu/internal/plans"
"github.com/opentofu/opentofu/internal/states/statemgr"
"github.com/opentofu/opentofu/internal/tfdiags"
@@ -307,6 +308,9 @@ func (b *Cloud) Configure(ctx context.Context, obj cty.Value) tfdiags.Diagnostic
cfg.Headers.Set(tfversion.Header, tfversion.Version)
cfg.Headers.Set(headerSourceKey, headerSourceValue)
// Update user-agent from 'go-tfe' to opentofu
cfg.Headers.Set("User-Agent", httpclient.OpenTofuUserAgent(tfversion.String()))
// Create the TFC/E API client.
b.client, err = tfe.NewClient(cfg)
if err != nil {