-
Notifications
You must be signed in to change notification settings - Fork 8
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
Merge terraform-softlayer into terraform-ibmcloud (steps) #88
Comments
Access granted to @renier, @minsikl, @rbmateescu, @tflowcamdev |
Regarding Enable lazy validation of provider credentials for softlayer-only users I have 2 things on mind to tell users about missing credentials. Let me know what you think.
To me looks like 2nd option is more robust just that it touches all the resource, all the CRUD functions. I think I could minimize them by just putting them in the Read/Create.. as those are the 2 things which are done on a fresh resource. |
@ashishth09
In my understanding, the option 2 translates to
|
Absolutely, even I think the same. It would require touching all files but that is the best solution.
This would end up crashing terraform so not a good option as you mentioned. |
Returning an error is the only option. A plugin should never call os.Exit(). Let's talk about what our lazy-evaluation means, then. First, it can and should be done in a way that does not involve "changing the whole code base" (CTWCB). The first and easiest option is to simply let the API return the error due to insufficient credentials. Why is this not a good option? The API tells the user what the problem is instead of the provider telling the user what the problem is. In both cases, the user would see an error. But if you try to do this in the provider code, it would cause CTWCB, which we are trying to avoid. The second and less easy option which stays away from CTWCB, is to update the bluemix-go and softlayer-go code to check for non-empty credentials. Any call going through the lower-level client library would result in an error if credentials are empty or insufficient. You would not need any provider changes in this case. You would still return an error.
This should be filed as a bug in the go-client in any case. The go-client should never panic if being passed a null. It should just return an error. |
It is 👍 We need to check if the error returned by the SDK is good enough. For example some may return Access Denied or Authentication failure etc. The error returned by the clients won't specifically tell which provider parameters are missing though. They can be inferred and they would be close. If not then we should make them.
bluemix-go unlike softlayer-go is checking that and hence we know about the credentials issues in the provider configuration itself when we create our client. Now the CTWCB arised for us because unlike softlayer we don't pass around session but the API interface references which we create during the provider configuration and use ready-made in the resource CRUD. Since we configured them in the provider , we know if anything goes wrong the call would never come to the resource CRUD (since we return with error right away). Hence we never expect them to have nil value. It will blow if we don't check for their nil value in the whole code base in every resource CRUD now or do some others changes to retrieve their value.
This was meant in reference to our API interfaces above. Assuming someone doesn't configure the bluemix_api_key and we assume not to not configure bluemix apis, then nil is the value we would get in the CRUD at this point. |
@ashishth09 My suggestion is to start small (let the API return the error) and document it. Users (in the aggregate) will give you an idea of what more needs to be done there. But at that point, you've already made most of the progress. |
@renier, I guess so. At this point we need to figure out a way for the bluemix api interfaces first. |
Just thought I'd chime in and let y'all know that while switching from https://github.com/softlayer/terraform-provider-softlayer to this build of the plugin, I was bit by the fact that the new plugin no longer reads Thanks for all the good work on this! |
@mihasya , Thanks for the feedback 👍 We will look into it. |
This is a list of things that need to be done, in rough order, in order to merge the terraform-softlayer provider development effectively into the terraform-ibmcloud space:
@albee-jhoney
The text was updated successfully, but these errors were encountered: