Skip to content

Commit

Permalink
Switch to service_region configuration option
Browse files Browse the repository at this point in the history
  • Loading branch information
jbfavre committed Sep 13, 2021
1 parent 6fae293 commit 9e926e0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
12 changes: 10 additions & 2 deletions pagerduty/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,17 @@ func handleNotFoundError(err error, d *schema.ResourceData) error {
}

func providerConfigure(data *schema.ResourceData, terraformVersion string) (interface{}, error) {
var ServiceRegion = data.Get("service_region").(string)

if ServiceRegion == "us" || ServiceRegion == "" {
ServiceRegion = ""
} else {
ServiceRegion = ServiceRegion + "."
}

config := Config{
ApiUrl: data.Get("api_url").(string),
AppUrl: data.Get("app_url").(string),
ApiUrl: "https://api." + ServiceRegion + "pagerduty.com",
AppUrl: "https://app." + ServiceRegion + "pagerduty.com",
SkipCredsValidation: data.Get("skip_credentials_validation").(bool),
Token: data.Get("token").(string),
UserAgent: fmt.Sprintf("(%s %s) Terraform/%s", runtime.GOOS, runtime.GOARCH, terraformVersion),
Expand Down
3 changes: 1 addition & 2 deletions website/docs/index.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,5 @@ The following arguments are supported:

* `token` - (Required) The v2 authorization token. It can also be sourced from the PAGERDUTY_TOKEN environment variable. See [API Documentation](https://developer.pagerduty.com/docs/rest-api-v2/authentication/) for more information.
* `skip_credentials_validation` - (Optional) Skip validation of the token against the PagerDuty API.
* `api_url` - (Optional) Set PagerDuty client API url.
* `app_url` - (Optional) Set PagerDuty client APP url.
* `service_region` - (Optional) Which PagerDuty service region to use. Default to empty (use US region)

0 comments on commit 9e926e0

Please sign in to comment.