Go construct kit for the yawn.dev homelab: typed constructs synthesized to OpenTofu
  • Go 98.4%
  • Python 1.2%
  • Shell 0.4%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
John b10894966b
All checks were successful
CI / release-check-1 (push) Successful in 13s
CI / release-check (push) Successful in 0s
Release / release-1 (push) Successful in 19s
Release / release (push) Successful in 0s
CI / checks (push) Successful in 2m3s
Merge pull request 'release: 0.3.1-dev.7 (internal)' (#83) from release/internal-cdk-fix into main
Reviewed-on: #83
2026-11-27 09:00:33 +00:00
.forgejo feat(ci): signing requests must wait for CI; release 0.3.1-dev.5 2026-11-26 07:54:11 +00:00
apps feat(apps): provider slots declare their first signed version 2026-11-26 07:55:24 +00:00
ci feat(ci): signing requests must wait for CI; release 0.3.1-dev.5 2026-11-26 07:54:11 +00:00
cmd/yawn feat(deploy): add the always-waiting release command and typed admission 2026-11-22 14:28:31 +00:00
core core: app-wide ID claims; workflow: shared/external event steps, split concurrency (dev.26) 2026-11-18 23:48:59 +00:00
deploy fix(deploy): distinguish missing status from release failure 2026-11-27 08:31:08 +00:00
fleet feat(fleet): Observed.MAC for DHCP reservations (0.3.0-dev.3) 2026-11-17 15:10:26 +00:00
forgejo feat(forgejo): read-only deploy keys (0.3.0-dev.5) 2026-11-17 22:00:52 +00:00
internal/install feat!: rewrite cdk as a Go construct kit that synthesizes to .yawn/ (0.2.0-dev.1) 2026-11-17 04:33:02 +00:00
oidc feat(apps): application deploy slots and yawn app-verify (0.3.0-dev.12) 2026-11-18 03:31:41 +00:00
pipeline refactor(workflow): remove release constructs no consumer uses; release 0.3.1-dev.4 2026-11-25 14:58:24 +00:00
proxmox feat(proxmox): add staged QEMU guests with a default-deny firewall 2026-11-23 23:16:22 +00:00
route Add typed service-owned LAN route declarations and hostname ownership claims 2026-11-19 13:24:27 +00:00
wiki refactor(workflow): remove release constructs no consumer uses; release 0.3.1-dev.4 2026-11-25 14:58:24 +00:00
workflow feat(workflow): one failure notice per release (OnFailure); release 0.3.1-dev.6 2026-11-26 10:41:01 +00:00
workload refactor(workflow): remove release constructs no consumer uses; release 0.3.1-dev.4 2026-11-25 14:58:24 +00:00
xyops feat(xyops): add custom Event Plugins (NewPlugin) and plugin-backed pipeline steps 2026-11-24 15:21:08 +00:00
.gitignore feat!: rewrite cdk as a Go construct kit that synthesizes to .yawn/ (0.2.0-dev.1) 2026-11-17 04:33:02 +00:00
CHANGELOG.md release: publish 0.3.1-dev.7 internally 2026-11-27 08:58:26 +00:00
go.mod feat!: rewrite cdk as a Go construct kit that synthesizes to .yawn/ (0.2.0-dev.1) 2026-11-17 04:33:02 +00:00
LICENSE Initial commit 2026-11-17 02:51:59 +00:00
README.md feat(xyops): add custom Event Plugins (NewPlugin) and plugin-backed pipeline steps 2026-11-24 15:21:08 +00:00
release.json feat(ci): generated workflows from yawn.json, yawn run/request, release binaries (0.3.0-dev.21) 2026-11-18 15:02:45 +00:00
VERSION release: publish 0.3.1-dev.7 internally 2026-11-27 08:58:26 +00:00
yawn.json feat(release): advance the matching channel after each CDK publish 2026-11-23 23:30:36 +00:00

john/cdk

A small, strongly typed Go kit for infrastructure as code, in the style of the AWS CDK. Programs build an App of Stacks of Resources; Synth writes plain OpenTofu configuration to .yawn/. OpenTofu still does all planning, applying and state.

  • Library, not a service. Repositories depend on this module and own their programs. john/arch runs them in CD.
  • .yawn/ is built in CI only. It is gitignored and never committed.
  • Standard library only. No third-party Go dependencies.
  • Deterministic. The same program always writes the same bytes.
  • Nothing left to defaults. Constructs write every setting explicitly.

Usage guidance lives in the wiki. This repository does not maintain standalone example applications; consumers own their stack programs.

Packages

Package Provides
core App, Stack, Resource, Provider, Synth, manifest.json, enforced state encryption, S3Backend, attached data documents
forgejo NewRepository, Protect, Provider (pinned svalabs/forgejo 1.7.0), UnreadSettings
proxmox Proxmox VE LXC containers (bpg/proxmox 0.122.0): import or create, destroy refused, Container.Fleet() identity
fleet Which Proxmox container runs which service (fleet.json), identity checks and drift reports for push deploys
xyops xyOps objects (john/xyops 0.1.2-dev.9): NewEvent, NewPlugin (custom Event Plugins), NewSecret (records and grants, never values), CheckInlineScripts, plan ID guard
workflow Native xyOps workflows: NewXyopsWorkflow (validated graph) and NewPipeline (plan → changes? → approval → deploy, run queue; Task or PluginTask steps) (design)
oidc Verifies Forgejo Actions ID tokens (RS256, JWKS, claim policy, replay guard)
ci Generated Forgejo workflows from yawn.json, the task runner, and xyOps requests (guide)
cmd/yawn run, tasks, ci, request, digest, version, providers, oidc-verify, fleet-check, fleet-diff, plan-guard, app-verify, bootstrap

yawn release binaries (linux amd64/arm64, static) and their SHA256SUMS are attached to every release from 0.3.0-dev.21; generated workflows install them by checksum.

Design: deploy control plane, also published to the repository wiki on each release.

.yawn/ layout

.yawn/
  manifest.json            # typed, data-only summary (stacks, providers, resources, imports, notes)
  <stack>/main.tf.json     # the stack's OpenTofu configuration
  <stack>/encryption.tf    # enforced client-side encryption of state and plans
  <stack>/.terraform.lock.hcl  # provider hashes from the release pins
  fleet.json               # optional attached document: the declared fleet

manifest.json is data only, so a consumer such as john/arch can read it without running repository code. Its manifest_version is 1; consumers must refuse versions they do not understand.

Safety rules

  • Repositories are never deleted. prevent_destroy is set, and a forced destroy archives the repository instead.
  • No hidden defaults. Every writable provider attribute is either written or listed as creation-only. A test compares the constructs against the provider's schema, so a provider upgrade that adds a setting fails the build until the construct handles it.
  • Mandatory choices. Visibility must be chosen, and a protected branch must have at least one required check.
  • Exact provider pins. Exact versions, HTTPS release URLs, and SHA-256 plus OpenTofu h1 hashes. yawn providers checks both hashes, and the generated lock file makes OpenTofu check them again.
  • No secrets in output or state. Credentials come from the environment (FORGEJO_API_TOKEN, AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY, TF_VAR_*). Literal values for token, password or secret settings are refused, and the state passphrase must be an ephemeral variable so it never reaches a plan.
  • Unread settings are explicit. svalabs/forgejo does not read some repository settings back, so UI changes to them are invisible to plans; forgejo.UnreadSettings lists them for a separate drift check.
  • Atomic synth. A failed synth leaves the previous .yawn/ untouched.

Development

Go 1.27.4 and OpenTofu 1.13.9 are pinned in .forgejo/scripts/tools.py. .forgejo/scripts/check.sh TOOLS runs gofmt, module verification, vet, tests (including synthesis, schema and runtime coverage), and govulncheck. Consumer repositories validate their actual synthesized stacks with OpenTofu; this repository no longer runs example-based provider integration validation. Update golden files with go test ./core -update and review the diff.

History

v0.2.0-dev.1 targeted Gitea through a fork of its provider and Gitea's state registry. Forgejo has neither, so 0.3.0 moves to svalabs/forgejo and S3 state; the gitea package is removed.

Up to v0.1.0-dev.1 this repository held HCL modules (Caddy edge, SSO, oauth2-proxy, Peekaping status sites). They had no consumers and are retired from main; the tag keeps them.

Releases

Versioned with john/release: change VERSION and CHANGELOG.md in a PR, and merging tags the commit. Consumers pin a tag in go.mod.