From 885935962c52933ce49573bb5181b2a52e57c009 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Thu, 21 Jul 2016 10:56:32 -0400 Subject: [PATCH] Add a terraform version header to all atlas calls Using the DefaultHeader added to the atlas.Client --- command/push.go | 3 +++ terraform/version.go | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/command/push.go b/command/push.go index 67cac6740..1abe13e0b 100644 --- a/command/push.go +++ b/command/push.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/atlas-go/archive" "github.com/hashicorp/atlas-go/v1" + "github.com/hashicorp/terraform/terraform" ) type PushCommand struct { @@ -126,6 +127,8 @@ func (c *PushCommand) Run(args []string) int { } } + client.DefaultHeader.Set(terraform.VersionHeader, terraform.Version) + if atlasToken != "" { client.Token = atlasToken } diff --git a/terraform/version.go b/terraform/version.go index e781d9c25..7462a3c67 100644 --- a/terraform/version.go +++ b/terraform/version.go @@ -16,3 +16,7 @@ const VersionPrerelease = "dev" // benefit of verifying during tests and init time that our version is a // proper semantic version, which should always be the case. var SemVersion = version.Must(version.NewVersion(Version)) + +// VersionHeader is the header name used to send the current terraform version +// in http requests. +const VersionHeader = "Terraform-Version"