00:00.0 / 00:00.0
README.md2.5 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