palantir / terraform-provider-tenablesc

Terraform provider for managing Tenable.SC configuration
Other
7 stars 4 forks source link

Update provider init to better clarify credential issues. #26

Closed dreamlibrarian closed 3 months ago

dreamlibrarian commented 1 year ago

When setting up a provider, if your credentials are incorrect, the initial GetCurrentUser call fails:

https://github.com/palantir/terraform-provider-tenablesc/blob/a6e055f5df3f957d97be554dd3191167de1dde69/internal/provider/provider.go#L84

But we're not wrapping the error in any kind of useful explainer so the user sees:

$ ./terraform plan
╷
│ Error: failed to get current user: failed to unmarshal response: json: cannot unmarshal string into Go value of type tenablesc.CurrentUser
│
│   with provider["registry.terraform.io/palantir/tenablesc"],
│   on providers.tf line 11, in provider "tenablesc":
│   11: provider "tenablesc" {

instead of anything more explanatory. Add a credential check message.

dreamlibrarian commented 1 year ago

This seems to be the result of very narrow misconfigurations in the provider, so this may be difficult to reconcile.