Dependencies & Unit Status
Status: Stable OpenTaco models explicit dependencies between units with one resource per edge (opentaco_dependency
). No database is introduced: the entire dependency graph lives in a normal Terraform state for a dedicated unit named __opentaco_system
.
Key ideas:
- One edge per output: from
(from_unit_id, from_output)
to(to_unit_id, to_input)
. - Store only digests (base64url SHA‑256 of canonical JSON) and timestamps — no plaintext values.
- Update on writes: when a unit is written, the service updates all relevant edges in a single read/modify/write cycle under a lock.
- Derive status at query time with red/yellow/green semantics and present friendly labels in the CLI.
Provider resource: opentaco_dependency
in_digest
, out_digest
, status
, last_in_at
, last_out_at
.
Deterministic ID:
Graph storage and surgery
- Graph lives in
__opentaco_system
and is just a normal tfstate withopentaco_dependency
resources. - On any unit write (HTTP backend or S3‑compat), the service:
- Source refresh (outgoing): for edges where
from_unit_id
matches the written unit, computein_digest
from that output and setstatus
took
ifin_digest == out_digest
, elsepending
. If the output is missing, setunknown
. - Target acknowledge (incoming): for edges where
to_unit_id
matches the written unit, copyout_digest ← in_digest
, setstatus = ok
.
- Source refresh (outgoing): for edges where
- The service acquires a lock on
__opentaco_system
, reads, modifies in memory, bumpsserial
, writes, and unlocks. - If graph tfstate is missing/corrupt or locked, the write proceeds and the graph update is skipped with a warning (non‑blocking).
Hashing
- Digest = base64url(SHA‑256(canonical JSON bytes of the output))
- Canonical JSON approximates RFC 8785: sorted object keys, arrays in order, no insignificant whitespace.
- Equality is by digest only.
Status semantics
-
Edge (
status
):- ok:
in_digest == out_digest
and non‑empty - pending: both set and unequal
- unknown: source output missing or not yet set
- ok:
-
Unit (derived):
- red: the unit has any incoming edge with
pending
- yellow: no incoming pending, but an upstream (transitively) is red
- green: neither red nor yellow
- red: the unit has any incoming edge with
- up to date (green)
- needs re-apply (red)
- might need re-apply (yellow)
API & CLI
- API:
GET /v1/units/{id}/status
returns unit status and incoming edges. - CLI:
taco unit status [<id> | --prefix <pfx>] [-o json]
- No args (or
--prefix /
) lists all units. - Table output uses the friendly, colored labels above;
-o json
returns raw statuses.
- No args (or
Example
Seeexamples/dependencies/
for a runnable A→B→C setup. A’s output includes a timestamp so every apply simulates a new upstream change.