-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
provider/ns1: Ensure provider checks for credentials #12920
Conversation
builtin/providers/ns1/provider.go
Outdated
httpClient.Transport = tr | ||
config := Config{ | ||
Key: d.Get("apikey").(string), | ||
Endpoint: d.Get("endpoint").(string), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should follow the pattern of
if v, ok := d.GetOk("endpoint"); ok {
config.Endpoint = v.(string)
}
when we are adding optional parameters to the config block
Sound ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great point, i wasnt thinking when moving away from GetOk
. Making fix now.
I was wrong about what caused the error, it was a bug in the ns1-go client that wasnt properly handling 401s. Updating the ns1-go client via govendor and running acctests then will include in this PR |
Thanks for the work here @pashap :) |
Seconded, thanks for this work @pashap! |
LGTM! The build failure is not related to this - it is a timing out test in the core
|
@kian would you mind making a new issue for that? thank you |
* provider/ns1: Ensure provider checks for credentials * provider/ns1: stick with GetOk for provider config vars * provider/ns1: NS1 go client fixes for handling http errors
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Fixes: #12833
I somehow never added a check for the ns1 api key, this PR mimics other providers
Config
structures. Also, this PR ensures defaults for the ns1 api endpoint and whether to ignore ssl in the client(use terraform often for local development).