Add a terraform version header to all atlas calls

Using the DefaultHeader added to the atlas.Client
This commit is contained in:
James Bardin 2016-07-21 10:56:32 -04:00
parent d6d0c9087e
commit 885935962c
2 changed files with 7 additions and 0 deletions

View File

@ -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
}

View File

@ -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"