Skip to content

Commit

Permalink
Rename token_user with user_token
Browse files Browse the repository at this point in the history
  • Loading branch information
jbfavre committed Oct 25, 2021
1 parent 3f68ec0 commit 8e9c219
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions pagerduty/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type Config struct {
Token string

// The PagerDuty User level token for Slack
TokenUser string
UserToken string

// Skip validation of the token against the PagerDuty API
SkipCredsValidation bool
Expand Down Expand Up @@ -76,7 +76,7 @@ func (c *Config) Client() (*pagerduty.Client, error) {

func (c *Config) SlackClient() (*pagerduty.Client, error) {
// Validate that the user level PagerDuty token is set
if c.TokenUser == "" {
if c.UserToken == "" {
return nil, fmt.Errorf(invalidCreds)
}

Expand All @@ -88,7 +88,7 @@ func (c *Config) SlackClient() (*pagerduty.Client, error) {
BaseURL: c.AppUrl,
Debug: logging.IsDebugOrHigher(),
HTTPClient: httpClient,
Token: c.TokenUser,
Token: c.UserToken,
UserAgent: c.UserAgent,
}

Expand Down
4 changes: 2 additions & 2 deletions pagerduty/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func Provider() *schema.Provider {
DefaultFunc: schema.EnvDefaultFunc("PAGERDUTY_TOKEN", nil),
},

"token_user": {
"user_token": {
Type: schema.TypeString,
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("PAGERDUTY_USER_TOKEN", nil),
Expand Down Expand Up @@ -127,7 +127,7 @@ func providerConfigure(data *schema.ResourceData, terraformVersion string) (inte
AppUrl: "https://app." + ServiceRegion + "pagerduty.com",
SkipCredsValidation: data.Get("skip_credentials_validation").(bool),
Token: data.Get("token").(string),
TokenUser: data.Get("token_user").(string),
UserToken: data.Get("user_token").(string),
UserAgent: fmt.Sprintf("(%s %s) Terraform/%s", runtime.GOOS, runtime.GOARCH, terraformVersion),
}

Expand Down
2 changes: 1 addition & 1 deletion pagerduty/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func testAccPreCheckPagerDutyAbility(t *testing.T, ability string) {

config := &Config{
Token: os.Getenv("PAGERDUTY_TOKEN"),
TokenUser: os.Getenv("PAGERDUTY_USER_TOKEN"),
UserToken: os.Getenv("PAGERDUTY_USER_TOKEN"),
}

client, err := config.Client()
Expand Down

0 comments on commit 8e9c219

Please sign in to comment.