Add a terraform version header to all atlas calls
Using the DefaultHeader added to the atlas.Client
This commit is contained in:
parent
d6d0c9087e
commit
885935962c
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue