EXAMPLE
1Password Secrets
Declarative secrets backed by 1Password, resolved with the !secret YAML function and the atmos secret CLI.
Try it out
- Install Atmos
- Try the example
Copy the example into a new directory and make it your own:
atmos init examples/onepassword-secrets
cd onepassword-secrets
Follow the README for prerequisites and next steps.
See it in action
RECORDED DEMO Real commands. Real output.
README.md2.7 KB
View on GitHub1Password secrets example
Declarative secrets backed by 1Password, resolved with the
!secret YAML function and the atmos secret CLI.
This example runs against a local Mockoon 1Password Connect mock through Atmos emulator components, so it is testable without a 1Password account.
How it works
- Emulator (
stacks/catalog/emulator/onepassword-connect.yaml): amockoon/1password-connectemulator that serves a local 1Password Connect mock data file. - Store (
atmos.yaml): atype: onepasswordstore namedop.secret: trueis implied — a 1Password store is always a secret backend (resolved via!secret, never!store). It supports full CRUD:atmos secret setwrites the value to the field the reference points to (creating the item, as an API Credential, if it does not exist), anddeleteremoves it. - Declarations (
stacks/catalog/api.yaml): each secret carries anop://vault/item/fieldsecret reference via thereferencefield. References support Go templating —op://{{ .atmos_stack }}/postgres/passwordresolves a different item per stack. - Usage:
datadog_api_key: !secret DATADOG_API_KEY.
Authentication
No op CLI is required. The store auto-selects a backend:
| Backend | Set these | Typical use |
|---|---|---|
| Service Account | OP_SERVICE_ACCOUNT_TOKEN | local dev |
| Connect | OP_CONNECT_HOST + OP_CONNECT_TOKEN | CI / cloud |
Force one with options.mode: service-account or options.mode: connect.
Service accounts cannot access your built-in Private/Personal/Employee vault — use a shared named vault.
Try it
cd examples/onepassword-secrets# Start the local 1Password Connect mockatmos emulator up onepassword-connect --stack dev --ephemeral# Resolve a mocked secretatmos secret get DATADOG_API_KEY --stack dev --component api --mask=false# Check declared-secret status and validationatmos secret list --stack dev --component apiatmos secret validate --stack dev --component api# Write and remove a mocked secretatmos secret set DB_PASSWORD=rotated-password --stack dev --component apiatmos secret delete DB_PASSWORD --stack dev --component api --force# Stop the emulatoratmos emulator down onepassword-connect --stack dev