load-vault-path-into-files.sh secret/keys/tls/example.com
Created
July 2, 2022 21:58
-
-
Save abdennour/d088b0413687b76037b45e6308c7a889 to your computer and use it in GitHub Desktop.
Load Vault Keys / Fields into Filesystem Dynamically
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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