Skip to content
This repository has been archived by the owner on Mar 8, 2022. It is now read-only.

Commit

Permalink
include provider version information in user agent
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkappa committed Apr 16, 2020
1 parent 0bbfa19 commit 41a8397
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ builds:
- windows
goarch:
- amd64
ldflags:
- -s -w -X version.ProviderVersion={{.Version}}
archives:
- name_template: "{{ .ProjectName }}_v{{ .Version }}_{{ .Os }}_{{ .Arch }}"
format: tar.gz
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ BUG FIXES:

* resource/auth0_client, resource/auth0_global_client: fix `null` scope issue ([#204](https://github.com/alexkappa/terraform-provider-auth0/pull/204))
* resource/auth0_connection: various bug fixes for auth0 type connections.
* resource/auth0_role: paginating role permissions for large amounts of permissions defined per role.

## 0.9.0 (April 14, 2020)

Expand Down
35 changes: 30 additions & 5 deletions auth0/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ import (

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/meta"
"github.com/terraform-providers/terraform-provider-auth0/version"

"gopkg.in/auth0.v4"
"gopkg.in/auth0.v4/management"
)

func Provider() *schema.Provider {
return &schema.Provider{
var provider *schema.Provider

func init() {
provider = &schema.Provider{
Schema: map[string]*schema.Schema{
"domain": {
Type: schema.TypeString,
Expand Down Expand Up @@ -62,18 +65,40 @@ func Provider() *schema.Provider {
}
}

func Provider() *schema.Provider {
return provider
}

func Configure(data *schema.ResourceData) (interface{}, error) {

domain := data.Get("domain").(string)
id := data.Get("client_id").(string)
secret := data.Get("client_secret").(string)
debug := data.Get("debug").(bool)

userAgent := fmt.Sprintf("Go-Auth0-SDK/%s; Terraform-SDK/%s",
auth0.Version,
meta.SDKVersionString())
userAgent := fmt.Sprintf("Terraform-Provider-Auth0/%s (Go-Auth0-SDK/%s; Terraform-SDK/%s; Terraform/%s)",
Version(),
SDKVersion(),
TerraformSDKVersion(),
TerraformVersion())

return management.New(domain, id, secret,
management.WithDebug(debug),
management.WithUserAgent(userAgent))
}

func Version() string {
return version.ProviderVersion
}

func SDKVersion() string {
return auth0.Version
}

func TerraformVersion() string {
return provider.TerraformVersion
}

func TerraformSDKVersion() string {
return meta.SDKVersionString()
}
4 changes: 2 additions & 2 deletions version/version.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package version

// Version is set during the release process.
var Version = "latest"
// ProviderVersion is set during the release process.
var ProviderVersion = "dev"

0 comments on commit 41a8397

Please sign in to comment.