Skip to content

Instantly share code, notes, and snippets.

@abdennour
Created July 2, 2022 21:58
Show Gist options
  • Save abdennour/d088b0413687b76037b45e6308c7a889 to your computer and use it in GitHub Desktop.
Save abdennour/d088b0413687b76037b45e6308c7a889 to your computer and use it in GitHub Desktop.
Load Vault Keys / Fields into Filesystem Dynamically

usage

load-vault-path-into-files.sh secret/keys/tls/example.com

#!/bin/sh
secpath=${1} # .i.e. secret/keys/tls/example.com
vault kv get -format json ${secpath} | jq -r '.data.data|keys[]' | while read -r key;do
mkdir -p $(dirname ${key})
vault kv get -format json ${secpath} | jq -r '.data.data["'"${key}"'"]' > ${key}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment