Skip to content

Module XIX — the own API and manage-as-code surface

Module XIX is not a feature bolted onto the engine — it is the engine’s surface. Every other module reaches the outside world through the same first-party API, and the web UI is a presentation layer over that exact contract, not a parallel one. This page is the reference for what that surface exposes today and how to manage the control plane as code, with its real boundaries.

The engine speaks one REST API under /v1 (chi router, hardened http.Server) and a focused, frozen gRPC mirror of it (olivares.api.v1: server info, agent read/create, audit verification, plus the standard health service). gRPC is a deliberate subset, not full parity — new endpoints land in REST first. Both cables run the same authenticate → resolve-tenant → authorize chain and map errors identically, so a not-found is indistinguishable from a cross-tenant resource on either wire.

The REST surface is published as an OpenAPI 3.1 contract rendered at the API reference directly from the product’s authored schema. That document is the contract of record for the stable core surface; the module routes are published separately as a beta document — the module-route reference (see the honest limits below). The same functionality is also driveable from the terminal — see the CLI reference — because the CLI is the engine, not a wrapper over it.

Authentication is opaque server-side bearer tokens, not JWT. A token is purpose-prefixed (session vs. API key); the server persists only a public selector and a SHA-256 of the secret, and compares the secret in constant time. The consequences that matter for a manage-as-code workflow: tokens are immediately revocable, carry no claims or secrets, and add no crypto-parsing attack surface. An API token is bound to a (tenant, role) or is an unbound system-level credential; a request whose tenant header disagrees with a bound token is refused, never silently widened.

The terraform-provider-olivares provider is a separate Go module and a pure REST client — it never imports the engine core or the connector SDK, keeping the large provider dependency tree out of the core’s supply chain. Configured with an endpoint, a sensitive API token, and an optional tenant, it manages a deliberately small, declared set of objects:

KindNameManages
resourceolivares_agentan agent’s catalog definition (full CRUD + import)
resourceolivares_policya governance policy declaration
resourceolivares_agent_identity_bindingthe binding of an agent to a non-human identity
resourceolivares_deploymenta deployment definition (desired state, declarative)
data sourceolivares_policies / olivares_identitiesread-only views of the governed roster
data sourceolivares_access_edgesthe R/RW access map and its permitted-vs-observed drift
data sourceolivares_deployment / olivares_server_infoa deployment definition; engine metadata

These are the only resources and data sources the provider serves. Declaring an olivares_deployment records desired state in the control plane — it does not touch infrastructure; the apply path belongs to module VII and is a deny-closed seam.

The serving engine is secure-by-default: TLS is on (a self-signed cert is generated on first boot if none is supplied), the bind defaults to localhost, and listening locally is not an exemption from authorization. A fresh install has no credentials — it mints a one-time setup token to stdout and refuses every protected endpoint until the first administrator is created. Audit is append-only and hash-chained, with Ed25519-signed checkpoints that make rewriting history before a checkpoint cryptographically detectable.

The eventing platform (module XIX’s outbound half)

Section titled “The eventing platform (module XIX’s outbound half)”

Since the eventing platform shipped (modules/eventing), module XIX’s surface also includes tenant self-service event subscriptions: typed subscriptions over the catalog of bus events (edge.observed, cost.sampled, finding.reported, audit.recorded, …) with durable at-least-once delivery — retries with backoff, a dead-letter queue, and replay from a cursor — to an HMAC-signed webhook or a SIEM sink. The notify module (XV) remains the alert router to operator-provisioned destinations; eventing is the integrator-facing platform. A companion read-only posture export (modules/posture-export) lets a control tower poll the product’s ground-truth posture — access graph, drift, inventory, findings — as refs/hashes/relations only, with the export itself audited.