adds X-Terraform-Integration header

This can help differentiate cloud integration API requests from normal remote backend requests
This commit is contained in:
Brandon Croft 2021-10-27 21:23:19 -06:00 committed by Chris Arcand
parent 3d23a8e062
commit 6d9c919f55
1 changed files with 3 additions and 0 deletions

View File

@ -36,6 +36,8 @@ const (
defaultHostname = "app.terraform.io"
defaultParallelism = 10
tfeServiceID = "tfe.v2"
headerSourceKey = "X-Terraform-Integration"
headerSourceValue = "cloud"
)
// Cloud is an implementation of EnhancedBackend in service of the Terraform Cloud/Enterprise
@ -254,6 +256,7 @@ func (b *Cloud) Configure(obj cty.Value) tfdiags.Diagnostics {
// Set the version header to the current version.
cfg.Headers.Set(tfversion.Header, tfversion.Version)
cfg.Headers.Set(headerSourceKey, headerSourceValue)
// Create the TFC/E API client.
b.client, err = tfe.NewClient(cfg)