Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional base_url configuration #366

Merged
merged 1 commit into from
Dec 2, 2021
Merged

Conversation

busatol
Copy link
Contributor

@busatol busatol commented Aug 4, 2021

This pr adds the optional base_url configuration argument that is passed to the API client.

provider "pagerduty" {
  token     = "xxxxxxxxxxxx"
  base_url  = "https://custom-cache-proxy.com"
}

@stmcallister
Copy link
Contributor

Thank you for submitting this! However, I think I want to go a slightly different direction. Rather than having folks set the URLs directly I think we should just provide a service_region field to the provider tag. Then the provider will figure out which URLs to use. At least that's my thoughts right now.

From a user perspective, do you think that would be a cleaner approach?

@rymir
Copy link

rymir commented Sep 13, 2021

Hi @stmcallister, thanks for looking into this.

What we're trying to do here is actually setting a totally custom proxy endpoint, running internally in our infrastructure. We're using these custom endpoints to cache http GETs therefore reducing the throughput to the 3rd party providers (pagerduty in this case) and reduce the chances of hitting 3rd party providers rate limiting throttling.

Of course, as you mention it can be used to force traffic to a specific pagerduty "service_region" endpoint, but we need to be able to set "any" configurable endpoint instead of just a subset of them managed by the provider itself.

@rymir
Copy link

rymir commented Sep 20, 2021

@stmcallister any updates?

@stmcallister
Copy link
Contributor

Ah, I hadn't thought of that scenario. 🤔 Let me think about this one and talk to a few folks.

@busatol
Copy link
Contributor Author

busatol commented Oct 27, 2021

@stmcallister this PR now conflicts with the service_region logic added here #384. Any thought?

@stmcallister
Copy link
Contributor

@busatol It does. I feel the service_region logic is going to be more useful to more users. Also, with the addition of the slack_connection resource we now need to support multiple baseURLs. All the other resources use api.pagerduty.com while the slack_connection resource uses the app.pagerduty.com url. However, if your use case, you would only need one base_url because it's going to be the address of your proxy. Right?

How about we name your field something like override_base_url and then mention in the docs and README that it's used for proxy use-cases? That way other users won't get confused about whether to use the field for setting EU urls, etc.

@busatol busatol force-pushed the master branch 4 times, most recently from 18b90f6 to ee6ea05 Compare November 10, 2021 20:20
@busatol
Copy link
Contributor Author

busatol commented Nov 10, 2021

@busatol It does. I feel the service_region logic is going to be more useful to more users. Also, with the addition of the slack_connection resource we now need to support multiple baseURLs. All the other resources use api.pagerduty.com while the slack_connection resource uses the app.pagerduty.com url. However, if your use case, you would only need one base_url because it's going to be the address of your proxy. Right?

How about we name your field something like override_base_url and then mention in the docs and README that it's used for proxy use-cases? That way other users won't get confused about whether to use the field for setting EU urls, etc.

@stmcallister updated. I added the field api_url_override.

@stmcallister
Copy link
Contributor

@busatol Thanks for making the naming change. Looks like this branch is still conflicting with master. Will you merge with the latest master and fix the conflicts? Once I can test it successfully i'll approve and merge.

@busatol
Copy link
Contributor Author

busatol commented Nov 25, 2021

@busatol Thanks for making the naming change. Looks like this branch is still conflicting with master. Will you merge with the latest master and fix the conflicts? Once I can test it successfully i'll approve and merge.

@stmcallister done. The PR is up to date with master 👍

Copy link
Contributor

@stmcallister stmcallister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! thanks for fixing the merge conflicts! 🎉

@stmcallister stmcallister merged commit 7ecfd59 into PagerDuty:master Dec 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants