Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HashiCorp Vault project - write additional key/value pair without overwritting existing ones

When I put the first key/value pair to Vault:

vault write secret/item/33 item_name='item_name' 

It works well and I get:

vault read secret/item/33

Key                     Value
---                     -----
refresh_interval        768h0m0s
item_name               item_name

But if I want put additional field item_type:

vault write secret/item/33 item_type='item_type' 

It overwrites existing one:

vault read secret/item/33

Key                     Value
---                     -----
refresh_interval        768h0m0s
item_type               item_type

How to write additional field - key/value pair to Vault without replacing existing ones?

like image 603
Justinas Jakavonis Avatar asked Mar 22 '17 14:03

Justinas Jakavonis


People also ask

What is secret engine in vault?

What is a secrets engine? Secrets engines are Vault components which store, generate or encrypt secrets. In Your First Secrets tutorial, you used key/value v2 secrets engine to store data. Some secrets engines like the key/value secrets engine simply store and read data.

What is KV in HashiCorp vault?

The kv secrets engine is a generic Key-Value store used to store arbitrary secrets within the configured physical storage for Vault.

Is HashiCorp vault a key management system?

HashiCorp's Vault Enterprise can be used as a flexible, very cost-effective, and scalable external key manager solution. It is certified by NetApp, supports the OASIS KMIP protocol, and integrates with any PKCS #11 compliant HSM.


2 Answers

vault kv put secret/hello foo=world excited=yes even with Key/value v1 you should be able to set multiple as long as you specify both in the same put command.

like image 99
CodeNameCrazy Avatar answered Sep 20 '22 14:09

CodeNameCrazy


You can only store one value per key. (Confirmed by Vault developer) Either you think on a data structure that is suitable and write a long string to this key or you are using a single key for each value which could look as follows:

vault write secret/item/33/name item_name='item_name'
vault write secret/item/33/type item_type='item_type'
like image 35
muehsi Avatar answered Sep 24 '22 14:09

muehsi