Skip to content

Commit

Permalink
provider: Add terraform-provider-aws/VERSION to User-Agent header (ha…
Browse files Browse the repository at this point in the history
…shicorp#17486)

* provider: Add terraform-provider-aws/VERSION to User-Agent header

Reference: hashicorp#17483

Filled in during the TeamCity release process and future-proofed with `.goreleaser.yml` update.

* Update CHANGELOG for hashicorp#17486
  • Loading branch information
bflad authored Feb 8, 2021
1 parent 509d38b commit 7a0bb65
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .changelog/17486.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
provider: Add terraform-provider-aws version to HTTP User-Agent header
```
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ builds:
- goarch: '386'
goos: darwin
ldflags:
- -s -w -X aws/version.ProviderVersion={{.Version}}
- -s -w -X version.ProviderVersion={{.Version}}
mod_timestamp: '{{ .CommitTimestamp }}'
changelog:
skip: true
Expand Down
5 changes: 3 additions & 2 deletions aws/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ import (
"github.com/hashicorp/aws-sdk-go-base/tfawserr"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/logging"
"github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags"
"github.com/terraform-providers/terraform-provider-aws/version"
)

type Config struct {
Expand Down Expand Up @@ -425,8 +426,8 @@ func (c *Config) Client() (interface{}, error) {
UserAgentProducts: []*awsbase.UserAgentProduct{
{Name: "APN", Version: "1.0"},
{Name: "HashiCorp", Version: "1.0"},
{Name: "Terraform", Version: c.terraformVersion,
Extra: []string{"+https://www.terraform.io"}},
{Name: "Terraform", Version: c.terraformVersion, Extra: []string{"+https://www.terraform.io"}},
{Name: "terraform-provider-aws", Version: version.ProviderVersion, Extra: []string{"+https://registry.terraform.io/providers/hashicorp/aws"}},
},
}

Expand Down
4 changes: 4 additions & 0 deletions version/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package version

// ProviderVersion is set during the release process to the release version of the binary
var ProviderVersion = "dev"

0 comments on commit 7a0bb65

Please sign in to comment.