tofu-api

v0.6 · early

Any OpenTofu or Terraform provider, as a REST API.

tofu-api runs an OpenTofu or Terraform provider over the plugin protocol — without HCL, plan or state file — and generates the OpenAPI contract from its schemas. What is left to write is what is specific to your platform, in one YAML file per provider.

The problem

Why tofu-api

  • An internal API in front of a product is mostly a client of that product’s API — and writing, then maintaining, that client is most of the work.
  • A Terraform provider is that client, already written: maintained by the vendor or its community, tested daily by everyone who manages that product with Terraform.
  • tofu-api gives callers that are not Terraform — a portal, a script, another service — a plain REST API on top of it.

No code per resource

The contract comes from the provider’s schemas. Bumping the provider and regenerating it is the API change.

Rules in YAML

Values the service sets, defaults, patterns, enums and hidden attributes, with CEL expressions.

Credentials per namespace

A provider process per namespace, configured from Vault, so a tenant reaches only what its credentials allow.

Contract enforced

Requests that do not match are a 400 before the provider is called. Errors are RFC 9457 problems.

Status

At a glance

Version
v0.6 — early stage
Tested live
Grafana and random providers — see Testing
Platforms
linux amd64 and arm64, RPM and DEB packages
Known limits
Limits
Built on
lib
License
MIT
Source
github.com/infrapi/tofu-api

Contribute to tofu-api

Issues, ideas and pull requests are welcome on GitHub.