From 6d9c919f55227a05264942b18a717cedbb65b8f2 Mon Sep 17 00:00:00 2001 From: Brandon Croft Date: Wed, 27 Oct 2021 21:23:19 -0600 Subject: [PATCH] adds X-Terraform-Integration header This can help differentiate cloud integration API requests from normal remote backend requests --- internal/cloud/backend.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/cloud/backend.go b/internal/cloud/backend.go index caf6ffe308..7ae10b8cb0 100644 --- a/internal/cloud/backend.go +++ b/internal/cloud/backend.go @@ -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)