atmos secret init
Walk the declared secrets for a stack and interactively initialize or rotate them. With --stack
alone, the whole stack is provisioned: stack-scoped secrets once each plus every instance's
instance-scoped secrets. With --component, only that instance is provisioned. Missing secrets are
prompted with masked input; already-initialized secrets prompt to update (rotate) or skip —
making init an easy way to rotate secrets manually. --force rotates them all without asking.
Provide --input FILE, or redirect standard input, to initialize declared values from a dotenv
file non-interactively. Lines beginning with # and unquoted inline # comments are ignored.
Unknown keys warn by default; use --mode=strict to reject them before anything is written.
Usage
atmos secret init [flags]
--stack is required (prompted on a TTY when omitted) unless you use --all; --component is
optional — omit it to provision the entire stack. Use --all to provision every declared secret
across every stack.
See Secret scopes.
Examples
# Provision the whole stack (stack-scoped secrets + every instance's instance-scoped secrets)
atmos secret init --stack=prod
# Provision every declared secret instance in every stack
atmos secret init --all
# Provision just one instance, prompting for each missing secret
atmos secret init --stack=prod --component=api
# Re-prompt for and overwrite secrets that are already initialized
atmos secret init --stack=prod --component=api --force
# Preview what would be initialized without prompting or writing
atmos secret init --stack=prod --component=api --dry-run
# Disambiguate a component that exists in multiple types
atmos secret init --stack=prod --component=api --type=terraform
# Provision using a specific identity for the backend
atmos secret init --stack=prod --component=api --identity=aws/prod-secrets
# Initialize values from a dotenv file (or use: atmos secret init ... < .env.local)
atmos secret init --input .env.local --stack=prod --component=api
# Reject unknown dotenv keys instead of warning and skipping them
atmos secret init --input .env.local --mode=strict --stack=prod --component=api
Arguments
- n/a
- No positional arguments.
Flags
--stack(alias-s)The Atmos stack to operate on. Required.
Environment variable:
ATMOS_STACK--allProvision declared secrets across every stack. Cannot be combined with
--stackor--component.--component(alias-c)The Atmos component whose declared secrets are provisioned. 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--force(alias-f)Re-prompt for and overwrite secrets that are already initialized. Without this flag, already-initialized secrets are skipped.
--dry-runShow which secrets would be initialized without prompting for values or writing anything to the backend.
--inputRead dotenv
NAME=VALUEentries from a file. Use-for stdin. When omitted, redirected standard input is read automatically.--modeHandling for dotenv keys that are not declared by the selected component(s):
warn(default) warns and skips them;strictreturns an error before writing.
See Also
- atmos secret — Overview of the secret command group
!secretYAML function — Resolve declared secrets at runtime