Connect 1Password
Connect a 1Password service account as a source, so that op:// references become synced secrets.
Replace prod-1password with a name for the source. Name it for what it serves; with several sources, the name is how you choose one.
Prerequisites
- Permission for
secrets:CreateSecretSourceandsecrets:CreateSecret(the token is stored as a secret). In the console, alsosecrets:ListSecretSourcesto open Sources; without it the page says your policies do not grant it. - An enabled encrypt/decrypt KMS key.
- In 1Password, a service account (Developer → Service accounts) with read access to the vaults
your apps need. Copy its token; it starts with
ops_. - A free unit of the sources quota and of the secrets quota; see Quotas.
Connect the source
- Open Sources (in the Secrets navigation), and choose Connect a source.
- For Provider, choose 1Password.
- For Name, enter prod-1password.
- For Service account token, paste the token.
- (Optional) For Refresh every (minutes), enter 5 to 1440. The default is 60; 1Password limits how many reads a service account makes an hour.
- (Optional) For Encrypt the token with, choose a key.
- Choose Verify & connect.
The source appears with how many vaults the token reaches.
dcloud secrets sources create --name prod-1password --provider onepassword \
--credential "$OP_SERVICE_ACCOUNT_TOKEN"POST /secrets/api/sources
{ "name": "prod-1password", "provider": "onepassword", "credential": "ops_EXAMPLE" }resource "dcloud_secrets_source" "op" {
name = "prod-1password"
provider_type = "onepassword"
credential = var.op_service_account_token
}Result
The token is checked against 1Password before anything is stored; a rejected token stores nothing.
An accepted one is stored as the secret SOURCE_PROD_1PASSWORD_TOKEN (the name in upper case,
SOURCE_…_TOKEN), encrypted under the key you chose or, without one, the organization's default
key (else its first enabled encrypt/decrypt key), with a
version history and an access log like any secret. Every use of the token is written to that
access log.
The name is 2 to 63 lower-case letters, digits and hyphens, unique in the organization.
Refusals
422"1Password rejected the credential: …", for example "The token is valid but no vault is shared with this service account".409"A source named prod-1password exists", or "A secret named SOURCE_PROD_1PASSWORD_TOKEN already exists".409when no enabled key can encrypt the token, or a quota is full.
Related
Related