Skip to content
SHC Docs

shc vault set

set a secret value

Store a secret. The value is read from STDIN when it is given as ”-” or omitted entirely, or from a file with --value-file; passing it as a positional argument still works but puts the secret in the process list (/proc//cmdline, world-readable) and in your shell history, and warns that it has done so.

Where it lands. Without --scope the write goes to the narrowest tier the identifiers address, the same tier shc vault get with those identifiers reads first. -s <stack> alone implies -e default, matching get/rm/ls. With an explicit --scope the write is refused (X409905SECSHD) when a narrower row would hide it from a read at these identifiers; that is what --allow-shadowed waives.

shc vault set <key> [value|-] [flags]
# stdin: the secret never reaches argv
printf %s "$NEW_PASSWORD" | shc vault set -t master -s keycloak -e default admin_password -
# from a file (mode 0600), same guarantee
shc vault set -t master -s keycloak admin_password --value-file /run/secrets/kc
# interactive: prompts with echo suppressed
shc vault set -t master -s keycloak admin_password
# deliberately edit a broader tier beneath an existing override
shc vault set --scope tenant --allow-shadowed -t master -s keycloak admin_password -
--allow-shadowed write the explicitly-named --scope even though a narrower row will hide it from a read at these identifiers
-e, --environment string environment name (defaults to "default" when -s is given)
-h, --help help for set
--scope string write at this exact scope tier (global|tenant|stack|environment|deployment); default: the narrowest tier the identifiers address
-s, --stack string stack name
--value-file string read the secret from this file instead of argv ("-" for stdin)
--config stringArray extra YAML config file to layer on top of auto-discovered config; repeatable, later files win
-d, --debug enable debug mode (default: $SHC_DEBUG)
--exclude string comma-separated dotted paths to drop
--fields string comma-separated columns/keys to show (and their order)
--filter string comma-separated dotted paths to keep (drops everything else)
-o, --output string output format: tty|text|json|yaml (default: $SHC_OUTPUT)
-p, --password string vault password (visible in the process list, prefer --password-file)
--password-file string read the vault password from a file (mode 0600 expected); use '-' to read stdin. Takes precedence over --password and never puts the secret in argv
-t, --tenant string tenant name (default: $SHC_TENANT)
-v, --verbose verbose output (default: $SHC_VERBOSE)