diff --git a/pagerduty/provider.go b/pagerduty/provider.go index cb074c9c1..64ef48146 100644 --- a/pagerduty/provider.go +++ b/pagerduty/provider.go @@ -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), diff --git a/website/docs/index.html.markdown b/website/docs/index.html.markdown index bb35223ae..b1158bb83 100644 --- a/website/docs/index.html.markdown +++ b/website/docs/index.html.markdown @@ -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)