Infra & Cloud
bash
Intermediate
Vault Secret Fetcher
Retrieve a secret from HashiCorp Vault using the CLI and export as environment variables.
bash
#!/bin/bash
VAULT_ADDR=${VAULT_ADDR:-http://vault:8200}
SECRET_PATH=${1:-secret/myapp/production}
vault login -method=aws 2>/dev/null
vault kv get -format=json $SECRET_PATH \
| jq -r ".data.data | to_entries[] | \"export \(.key)=\(.value | @sh)\"" \
> /tmp/secrets.sh
source /tmp/secrets.sh
rm -f /tmp/secrets.sh
echo "Secrets loaded from $SECRET_PATH"
Prerequisites
- vault CLI
- HashiCorp Vault
- jq
Pro Tips
- → Use Vault Agent for automatic secret renewal in containers.
Commercial Licensing
Acquire a production access token or template license for enterprise deployment.
Module Info
- Language
- bash
- Level
- Intermediate
- Read time
- 3 min
- Published
- Jun 2026
- License
- Commercial License
Newsletter
New modules every week, directly to your inbox.
Similar Modules
AWS S3 Static Website
Terraform module to provision an S3 bucket for static website hosting.
terraform
·
Intermediate
AWS RDS Postgres Terraform
Terraform resource for an RDS PostgreSQL instance with encryption and backup.
terraform
·
Intermediate
ECS Task Force Stop
Force-stop all running ECS tasks in a service for emergency rollback.
bash
·
Intermediate