Search code examples
encryptioncryptographyhashicorp-vault

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?


Solution

  • 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'