GCP UserAgent now shows accurate Terraform version
This commit is contained in:
parent
68e0133da0
commit
d4f7cdc877
|
@ -10,8 +10,7 @@ import (
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
// TODO(dcunnin): Use version code from version.go
|
"github.com/hashicorp/terraform/terraform"
|
||||||
// "github.com/hashicorp/terraform"
|
|
||||||
"golang.org/x/oauth2"
|
"golang.org/x/oauth2"
|
||||||
"golang.org/x/oauth2/google"
|
"golang.org/x/oauth2/google"
|
||||||
"golang.org/x/oauth2/jwt"
|
"golang.org/x/oauth2/jwt"
|
||||||
|
@ -117,13 +116,11 @@ func (c *Config) loadAndValidate() error {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build UserAgent
|
versionString := terraform.Version
|
||||||
versionString := "0.0.0"
|
prerelease := terraform.VersionPrerelease
|
||||||
// TODO(dcunnin): Use Terraform's version code from version.go
|
if len(prerelease) > 0 {
|
||||||
// versionString := main.Version
|
versionString = fmt.Sprintf("%s-%s", versionString, prerelease)
|
||||||
// if main.VersionPrerelease != "" {
|
}
|
||||||
// versionString = fmt.Sprintf("%s-%s", versionString, main.VersionPrerelease)
|
|
||||||
// }
|
|
||||||
userAgent := fmt.Sprintf(
|
userAgent := fmt.Sprintf(
|
||||||
"(%s %s) Terraform/%s", runtime.GOOS, runtime.GOARCH, versionString)
|
"(%s %s) Terraform/%s", runtime.GOOS, runtime.GOARCH, versionString)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue