Skip to main content

H-09 Infrastructure as code

Brick H of the Enterprise AI Platform. Technology: OpenTofu (MPL, default) or Terraform (BSL, when the client license allows) modules for clusters, networks, buckets, KMS, DNS. French version: ../../fr/bricks/H-09-iac.md.

Role and responsibilities​

  • Provision cloud or on-prem infrastructure reproducibly: clusters, node pools (GPU), object storage with Object Lock, databases, KMS.

Position and interactions​

  • Execution path: workflow (plan, review, apply).
  • Outputs feed Helm values (endpoints, buckets) through External Secrets.

Open source and developed parts​

  • Open source reused: OpenTofu, Terraform providers.
  • Developed in the platform: Modules per cloud, remote state encrypted, policy checks (Trivy config, OPA) in CI.

Data model​

No dedicated table: state lives in Kubernetes objects, Git and the tool's own storage; actions are audited in eai.audit_events through the Control Plane when they go through the API.

Contract: contracts/v1/policy-contract.schema.json (schema_version 1.0). Usage is always reported with contracts/v1/usage-event.schema.json, audit with contracts/v1/audit-event.schema.json.

API endpoints​

MethodPath
GET/readyz

GET /readyz​

Response:

{
"status": "ready",
"checks": {
"postgres": "ok",
"redis": "ok",
"clickhouse": "ok"
}
}

SDK examples​

Python​

from enterprise_ai import EnterpriseAI

client = EnterpriseAI(base_url="<control-plane-url>", api_key="eai_live_xxx", tenant="acme", locale="en")
client.system.readyz()

TypeScript​

import { EnterpriseAI } from "@enterprise-ai/sdk";

const client = new EnterpriseAI({ baseUrl: "<control-plane-url>", apiKey: process.env.EAI_API_KEY, tenant: "acme", locale: "en" });
await client.meta.ready();

Java​

EnterpriseAIClient client = EnterpriseAIClient.builder()
.baseUrl("<control-plane-url>")
.apiKey(System.getenv("EAI_API_KEY"))
.tenant("acme")
.locale(Locale.ENGLISH)
.build();
client.meta().ready();

Go​

client, err := eai.NewClient(eai.WithBaseURL("<control-plane-url>"), eai.WithAPIKey(os.Getenv("EAI_API_KEY")), eai.WithTenant("acme"), eai.WithLocale("en"))
if err != nil { log.Fatal(err) }
ctx := context.Background()
_, err = client.Meta.Ready(ctx, nil)

Configuration​

No EAI_* variable: configured through Helm values and the tool's own configuration.

Helm values keys (deploy/helm/enterprise-ai/values.yaml): global.externalSecrets.

Security​

  • State encrypted, no secret in variables files, plan reviewed before apply.
  • Tenant resolved from the credential, never from the body; PostgreSQL row level security on every tenant table.
  • Every mutation and policy decision writes a hash chained audit event (G-11).
  • Errors use the standard envelope with message_i18n en and fr.

Observability​

  • Drift detection job (plan in check mode).
  • W3C traceparent propagated, X-Request-Id returned, spans carry eai.tenant_id, eai.project, eai.agent_id, eai.run_id.

FinOps units​

  • Resources tagged tenant/owner/environment for cloud cost allocation imported in H-02.

Failure modes and resilience​

  • Partial apply -> state lock and re-plan; no manual console changes.

Standalone adoption​

Modules usable alone to create the landing zone.

Acceptance tests​

  1. tofu validate and plan succeed for each environment in CI.

Implementation roadmap