secret block declares a named slot for a credential, such as an API token for your policy
administration system. It never holds the value. You give the slot a value in Effective after you
publish, and only an effect that lists the slot can read it.
Syntax
secret id=policy-admin-token
id is the slot’s name. The block takes no other attributes. Like other declarations, it can
sit anywhere in the document.
Fields
There is no field for the value itself, and none should be added to the source. Never paste a
credential into a procedure.
Read a secret in an effect
An effect reads a secret only when its header grants thesecrets service and lists the slot:
format:
- The slot name must be a string literal, written directly in the call. A name built at run time is refused.
- The slots the effect reads and the slots its
secrets=lists must be the same. A listed slot the effect never reads is an error. - Every listed slot must have a
secretblock.
Give a secret a value
- Publish the procedure. A draft can’t declare
secrets, so try secret-free changes as drafts and publish the source that reads secrets.
Publishing records each slot. Reading a version
lists them under
secrets, each with itsname,formatanddescription. - Set a value in Effective. Set it on the procedure’s page in the Effective app, under
Secrets. Each slot can have two values:
- Shared default: one value for the procedure, used by every run that has no override.
- Personal override: a person’s own value, used for runs that run as that person. It takes precedence over the shared default.
secret block from a later version doesn’t remove the slot: older versions and runs
in progress may still need it.
Example
This procedure reads a policy’s status from an illustrative policy administration system atpas.northwind.example, with a bearer token from the policy-admin-token slot.
read-policy-status.procedure.md
On retry and resume
- The value is read for each call. Each time the effect is called, including each retry, the run looks up the current value. All reads within one call see the same value.
- Changing a value needs no new version. Set a new shared default or override, and later effect calls use it. The procedure’s source and version don’t change.
- The value stays out of the record. Effective never writes a secret’s value to the source, the version or the run record. The run records which slot was used, never the value. Code that reads a secret must not return it in a step’s result, because results are recorded.
Common errors
A missing value isn’t a compiler error. It fails the effect call when the run reaches it.
See also
- Functions and effects: the effect header,
uses=and the other services an effect can use. call: run the effect that reads the secret.- Writes to your systems: calling your own systems safely.
schema: the other declaration that never runs.