Files
unkinben 7c851b8df5
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
Add terraform-provider-kea
Terraform/OpenTofu provider wrapping the kea-operator KeaAPI, modelled on
terraform-provider-encapi.

- add kea_subnet and kea_clientclass resources with full CRUD over the
  PUT/GET/DELETE /api/v1/{subnets,clientclasses}/{name} contract
- add provider config (endpoint + bearer token, KEA_API_TOKEN fallback);
  404 on read removes the resource from state
- add unit tests against httptest mock servers (client, wire round-trip,
  type conversions, schemas)
- add Makefile (patch|minor|major + package) and .woodpecker CI mirroring
  terraform-provider-encapi; tag release PUTs the zip to the artifactapi
  terraform-unkin registry under unkin/kea

Claude-Session: https://claude.ai/code/session_01JUoARVdmhxKQHyyyp1pxeT
2026-08-02 19:40:49 +10:00

1.5 KiB

terraform-provider-kea

Terraform / OpenTofu provider for the kea-operator KeaAPI: it manages Kea DHCP subnets and PXE client classes as KeaSubnet / KeaClientClass custom resources over the KeaAPI HTTP service.

Provider configuration

terraform {
  required_providers {
    kea = {
      source  = "git.unkin.net/unkin/kea"
      version = "0.0.1"
    }
  }
}

provider "kea" {
  endpoint = "https://keaapi.k8s.syd1.au.unkin.net"
  # token   = "..."   # defaults to $KEA_API_TOKEN
}

Both reads and writes require the bearer token. Set it out-of-band via the KEA_API_TOKEN environment variable (managed in Vault) rather than in HCL.

Resources

Resource Purpose
kea_subnet A DHCP subnet: pools, routers, DNS, PXE/boot options.
kea_clientclass A PXE client class matching by test expr or architecture.

The name attribute is the stable id (the CR name) and forces replacement when changed. option_data is a nested block of DHCP options (name, code, space, and required data).

Releases

Tagging vX.Y.Z builds terraform-provider-kea_X.Y.Z_linux_amd64.zip and uploads it to the ArtifactAPI Terraform registry (terraform-unkin remote, namespace unkin/kea), which serves it as a GPG-signed provider registry.

See examples/ for full usage.