Kayra
v0.14.0Identity, namespaces and RBAC for your platform.
Who callers are, which namespace they act in, what they may do there, and which APIs each namespace is subscribed to.
InfraPI turns the infrastructure products you already run into governed, multi-tenant REST APIs. One URL layout, one token, one RBAC model, an OpenAPI contract enforced on every request — so a portal, a CLI or a pipeline creates what it needs without a ticket.
# one YAML file per provider, no code per resource
$ tofu-api serve -config aws.yaml
$ curl -X POST \
localhost:8080/aws/v1/namespaces/acme/instance \
-H 'Authorization: Bearer …' \
-d '{"ami": "ami-0abc12de", "instance_type": "t3.micro"}'
201 Created
{
"id": "i-0f3c9a1e2b4d5e6f7",
"ami": "ami-0abc12de",
"instance_type": "t3.micro",
"private_ip": "10.0.1.23",
…
}/apis/{group}/{version}/namespaces/{ns}/{resource}
OpenAPI enforced
RFC 9457 errors
Prometheus · OpenTelemetryThe problem
Teams wait days for a host, a DNS record or a dashboard that a script could create in seconds.
Every internal API in front of a product is a hand-written client of that product, to keep in step with each of its releases.
Who may create what, in which team's space, is re-invented in each tool — or left to shared admin credentials.
How it fits together
Products
Identity, namespaces and RBAC for your platform.
Who callers are, which namespace they act in, what they may do there, and which APIs each namespace is subscribed to.
Any OpenTofu provider as a REST API, and as MCP tools for AI agents.
An OpenAPI contract generated from the provider's schemas, MCP tools generated from the contract, rules in one YAML file per provider, no code per resource.
One MCP endpoint for AI agents, in front of every API of the platform.
The APIs found in Kayra's catalog, their tools behind one endpoint after one login, every call made as the caller and checked by its API.
The Go foundation of every InfraPI service.
URL layout, auth, contract enforcement, RFC 9457 errors, MCP for AI agents, metrics, tracing and Vault, shared by every service.
How it works
Pick the resource types of an OpenTofu provider to expose, and the rules over them, in one YAML file.
provider:
source: hashicorp/aws
version: 6.0.0
config:
region: ${AWS_REGION}
resources:
aws_instance:
attributes:
instance_type:
enum: [t3.micro, t3.small]
One binary for every provider. The OpenAPI contract is generated from the provider's schemas at start.
systemctl enable --now tofu-api@aws
# contract at /aws/v1/-/openapi/aws/v1.json
# Swagger UI at /aws/v1/-/docs
Any caller gets a plain REST API, checked against the contract, scoped to its namespace — and AI agents the same API over MCP.
curl -X POST \
:8080/aws/v1/namespaces/acme/instance \
-d '{"ami":"ami-0abc…",
"instance_type":"t3.micro"}'
# AI agents: MCP at /aws/v1/-/mcp
Why InfraPI
Adopt one piece at a time — tofu-api alone in front of one product, Kayra for tenancy and RBAC, ulgen for AI agents, lib for your own services.
Every API serves its OpenAPI contract and rejects any request that does not match it, before a handler runs.
Each tenant, a team or a customer, owns its namespaces. With tofu-api each namespace runs with its own credentials from Vault, so isolation comes from the credentials.
Single Go binaries, systemd units, RPM and DEB packages, Prometheus metrics and OpenTelemetry traces. No cluster required.
Learn
Generate an OpenAPI contract for EC2 instances from the AWS provider's schemas with tofu-api gen, then restrict instance types with a rule. No AWS account needed.
From nothing to a namespace's user creating EC2 instances through your own API - a Go project from its contract with infrapi-cli, the AWS SDK for Go v2 behind it, Kayra authorizing every call. Runs against a local AWS emulator and a local InfraPI, no AWS account needed.
Every InfraPI product is developed in the open. Use it, fork it, open an issue or send a pull request.