Vault error while writing

Arun picture Arun · Apr 17, 2018 · Viewed 7.5k times · Source

I wanted to test Spring Cloud Vault configuration.

I installed a Vault server locally and when i try to write some key-values its failing and asking me to use vault kv put command.

While the example of Spring Cloud Config in this link shows the usage of vault write command

This is the error i get is

$ vault write secret/my-app foo=bar
Error writing data to secret/my-app: Error making API request.

URL: PUT http://127.0.0.1:8200/v1/secret/my-app
Code: 404. Errors:


WARNING! The following warnings were returned from Vault:

  * Invalid path for a versioned K/V secrets engine. See the API docs for the
  appropriate API endpoints to use. If using the Vault CLI, use 'vault kv put'
  for this operation.

Answer

vicsz picture vicsz · Apr 18, 2018

Try the following ..

./vault kv put secret/my-app password=123

I'll add that this is something new in 0.10.0.

Seems like 0.10.0 has some breaking API changes ... so solution #2 is to use an earlier version of Vault (v0.9.6). This includes defaulting to the v2 of the KV secret engine , which is versioned.

Solution #3 is to re-create the /secret engine with v1 of KV. Running the following:

./vault secrets disable secret 
./vault secrets enable -version=1 -path=secret kv