Using Logical() API to write to KV v2?

236 views
Skip to first unread message

Lars

unread,
Apr 23, 2018, 7:51:14 AM4/23/18
to Vault
Hello everyone

I don't want to start a discussion around when to use POST/PUT in a REST context, but why can't one use the Logical() API anymore for writing to the new KV Secrets Engine (aka v2)? The KV v2 API supports POST for writes, whereas v1 supports POST & PUT. Since Logical().Write() uses PUT one can't use it for v2 writes anymore. 

It is obvious that one can always write some Request code themselves, nevertheless I would prefer an out of the box API for such operations.

Any thoughts?

Thanks

Lars

Chris Hoffman

unread,
Apr 23, 2018, 8:34:17 AM4/23/18
to Vault
Vault does not differentiate between POST and PUT verbs and treats them the same (see https://www.vaultproject.io/api/index.html#reading-writing-and-listing-secrets).  There are some inconsistency in the documentation and that may be causing some of the confustion.

The url paths for the KV v2 API did change so make sure to check the paths you are writing to.

Chris
--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/vault/issues
IRC: #vault-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Vault" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vault-tool+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vault-tool/ada670ca-cd1a-4f16-b6d7-fd6eda0d827e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Lars

unread,
Apr 24, 2018, 4:05:37 AM4/24/18
to Vault
Thanks for the quick response!

Makes sense, I was indeed confused by the documentation (https://www.vaultproject.io/api/secret/kv/kv-v2.html#create-update-secret) where it only states POST as available verb + some code I saw in the cli where POST was used for writes.

Thanks

Lars
Reply all
Reply to author
Forward
0 new messages