Kayra
v0.3Identity, namespaces and RBAC for your platform.
Who callers are, which tenant they act in, what they may do there, and which APIs each tenant 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 tenant they act in, what they may do there, and which APIs each tenant is subscribed to.
Any OpenTofu provider as a REST API.
An OpenAPI contract generated from the provider's schemas, rules in one YAML file per provider, no code per resource.
The Go foundation of every InfraPI service.
URL layout, auth, contract enforcement, RFC 9457 errors, 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 /-/openapi/aws/v1.json
# Swagger UI at /-/docs
Any caller gets a plain REST API, checked against the contract, scoped to its namespace.
curl -X POST \
:8080/aws/v1/namespaces/acme/instance \
-d '{"ami":"ami-0abc…",
"instance_type":"t3.micro"}'
Why InfraPI
Adopt one piece at a time — tofu-api alone in front of one product, Kayra for tenancy and RBAC, lib for your own services.
Every API serves its OpenAPI contract and rejects any request that does not match it, before a handler runs.
Namespaces are the tenants. With tofu-api each one 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.
Every InfraPI product is developed in the open. Use it, fork it, open an issue or send a pull request.