-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Fix: move DefaultTokenHelper to vault/sdk #9786
Conversation
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
Facing the exact same case 2+ years later. |
…to-sdk Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
@jmthvt maybe. I've updated the branch to resolve the conflicts they were. |
Wouldn't it make more sense to put this in After all, |
One if full with helpers already. /~https://github.com/hashicorp/vault/tree/main/sdk/helper I didn't see where I could put it in the other: |
Before we worry about api vs sdk, can someone explain what the purpose behind making this available to other projects is? What problem does it solve? In other words, maybe the solution isn't making it easier to import, maybe the entire idea behind depending on this func in other projects is wrongheaded. |
Ah nevermind, I looked at #4055, as I should've before commenting. I get it now. I prefer sdk over api, as this isn't something that a typical vault client should care about. |
I dug a bit more into this and I have a different proposal. Instead of making DefaultTokenHelper available to other repos like these terraform providers, how about we add the desired functionality into api.Client itself? In other words, these projects are using DefaultTokenHelper because they want to behave like Vault CLI commands, in that $HOME/.vault-token gets used if $VAULT_TOKEN isn’t set. So let's make that easy by adding an option to api.Config, say a bool |
For clarity, DefaultTokenHelper looks for a token in |
Is there any movement on this PR? Did we come to a consensus? I am facing the same issue regarding the discouraged import for |
@ncabatoff and I discussed this PR again last week and came away with the following thoughts: We still somewhat like the idea of this being more generally the behaviour of the API package that Nick considered before, however that has a few shortcomings too:
On that basis, it seems perfectly reasonable and more pragmatic to merge this PR essentially as it is (once it's been rebased). There was a question raised about whether this should live in
We may review either in the future, but in the interest of getting this merged it seems like the best near-term solution is to merge it pretty much as is! Thanks @greut for the contribution and sorry it got stuck in decision mode for so long. If you would like to retain all the commit credit please feel free to rebase/merge latest changes here so we can get it merged. But equally happy to pick it up since it's been a while! |
Apologies, I didn't see this issue before opening #25744, wanting to solve exactly the same issue myself. I also then didn't read it carefully enough before merging because I see now that this thread/PR was leaning towards putting it in the Before I tag it, I just wanted to give a brief opportunity for anyone in this thread to strongly object to the |
I've just pushed |
@tomhjp thanks a bunch! The Nomad provider can get rid of a ton of dependencies now, hashicorp/terraform-provider-nomad#445 |
Some projects, such as
terraform-provider-nomad
are relying on theDefaultTokenHelper
which breaks the idea of only usingvault/api
, orvault/sdk
. This moves those to a new location.As vault 1.5.0 cannot be used via go.mod, it's shouldn't be adding more breakage. cf. #9575