Skip to content

Commit

Permalink
[Terraform]: Add provider version to useragent. (#891)
Browse files Browse the repository at this point in the history
Merged PR #891.
  • Loading branch information
rileykarson authored and modular-magician committed Nov 14, 2018
1 parent da8934a commit 5885b68
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build/terraform
2 changes: 1 addition & 1 deletion build/terraform-beta
12 changes: 8 additions & 4 deletions third_party/terraform/utils/config.go.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (

"github.com/hashicorp/terraform/helper/logging"
"github.com/hashicorp/terraform/helper/pathorcontents"
"github.com/hashicorp/terraform/version"

"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
Expand Down Expand Up @@ -167,9 +166,14 @@ func (c *Config) loadAndValidate() error {

client.Transport = logging.NewTransport("Google", client.Transport)

projectURL := "https://www.terraform.io"
userAgent := fmt.Sprintf("Terraform/%s (+%s)",
version.String(), projectURL)
terraformVersion := httpclient.UserAgentString()
<% if version.nil? || version == 'ga' -%>
providerVersion := fmt.Sprintf("terraform-provider-google/%s", version.ProviderVersion)
<% else -%>
providerVersion := fmt.Sprintf("terraform-provider-google-<%= version -%>/%s", version.ProviderVersion)
<% end -%>
terraformWebsite := "(+https://www.terraform.io)"
userAgent := fmt.Sprintf("%s %s %s", terraformVersion, terraformWebsite, providerVersion)

c.client = client
c.userAgent = userAgent
Expand Down

0 comments on commit 5885b68

Please sign in to comment.