mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
Update user-agent from go-tfe to opentofu where go-tfe is used (#807)
This commit is contained in:
parent
a1e110c679
commit
572d8d95d1
@ -23,6 +23,7 @@ import (
|
||||
"github.com/mitchellh/colorstring"
|
||||
"github.com/opentofu/opentofu/internal/backend"
|
||||
"github.com/opentofu/opentofu/internal/configs/configschema"
|
||||
"github.com/opentofu/opentofu/internal/httpclient"
|
||||
"github.com/opentofu/opentofu/internal/logging"
|
||||
"github.com/opentofu/opentofu/internal/states/remote"
|
||||
"github.com/opentofu/opentofu/internal/states/statemgr"
|
||||
@ -334,6 +335,9 @@ func (b *Remote) Configure(ctx context.Context, obj cty.Value) tfdiags.Diagnosti
|
||||
// Set the version header to the current version.
|
||||
cfg.Headers.Set(tfversion.Header, tfversion.Version)
|
||||
|
||||
// Update user-agent from 'go-tfe' to opentofu
|
||||
cfg.Headers.Set("User-Agent", httpclient.OpenTofuUserAgent(tfversion.String()))
|
||||
|
||||
// Create the remote backend API client.
|
||||
b.client, err = tfe.NewClient(cfg)
|
||||
if err != nil {
|
||||
|
@ -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 {
|
||||
|
@ -29,6 +29,7 @@ import (
|
||||
"github.com/opentofu/opentofu/internal/logging"
|
||||
"github.com/opentofu/opentofu/internal/tfdiags"
|
||||
"github.com/opentofu/opentofu/internal/tofu"
|
||||
"github.com/opentofu/opentofu/version"
|
||||
|
||||
uuid "github.com/hashicorp/go-uuid"
|
||||
"golang.org/x/oauth2"
|
||||
@ -648,6 +649,10 @@ func (c *LoginCommand) interactiveGetTokenByUI(hostname svchost.Hostname, credsC
|
||||
Token: token,
|
||||
Headers: make(http.Header),
|
||||
}
|
||||
|
||||
// Update user-agent from 'go-tfe' to opentofu
|
||||
cfg.Headers.Set("User-Agent", httpclient.OpenTofuUserAgent(version.String()))
|
||||
|
||||
client, err := tfe.NewClient(cfg)
|
||||
if err != nil {
|
||||
diags = diags.Append(fmt.Errorf("Failed to create API client: %w", err))
|
||||
|
Loading…
Reference in New Issue
Block a user