atmos secret get
Retrieve the value of a declared secret from its configured backend. get is a value-producing command, so it always fetches the real value from the backend. The displayed value is redacted unless you pass the global --mask=false flag. For structured secrets, use --path to extract a single nested field with a YQ expression.
Usage
atmos secret get NAME [flags]
Examples
# Retrieve a secret (displayed masked by default)
atmos secret get DATADOG_API_KEY --stack=prod --component=api
# Reveal the real value
atmos secret get DATADOG_API_KEY --stack=prod --component=api --mask=false
# Output as JSON
atmos secret get DATADOG_API_KEY --stack=prod --component=api --format=json
# Output as a shell-sourceable env assignment
atmos secret get DATADOG_API_KEY --stack=prod --component=api --format=env
# Extract a nested field from a structured secret with a YQ path
atmos secret get DB_CREDENTIALS --stack=prod --component=api --path='.credentials.password'
# Copy the raw value to the clipboard with no trailing newline
atmos secret get DATADOG_API_KEY --stack=prod --component=api --mask=false --raw | pbcopy
Arguments
NAMEThe name of the declared secret to retrieve.
Flags
--stack(alias-s)The Atmos stack to operate on. Required.
Environment variable:
ATMOS_STACK--component(alias-c)The Atmos component that declares the secret. Required.
Environment variable:
ATMOS_COMPONENT--typeThe component type (
terraform,helmfile,packer, oransible). Used to disambiguate when a component name exists in more than one type.--identity(alias-i)The identity to use when accessing the secret backend.
Environment variable:
ATMOS_IDENTITY--formatThe output format:
text,json, orenv. Defaults totext.--pathExtract a nested value from a structured secret using a YQ path expression (for example,
.hostor.credentials.password).--raw(alias-r)Print the raw value with no trailing newline (text only). Ideal for piping into another command or the clipboard (for example,
--raw | pbcopy) without capturing a stray newline. Combine with--pathto extract a scalar from a structured secret. Cannot be combined with--format=jsonor--format=env.
get always retrieves the real value because it is a value-producing command. The global --mask flag only controls whether the displayed value is redacted — pass --mask=false to reveal it.
See Also
- atmos secret — Overview of the secret command group
!secretYAML function — Resolve declared secrets at runtime