Manage your entire Laravel Forge estate as code — servers, sites, databases, daemons, SSL & more, reconciled by OpenTofu
resource "laravelforge_site" "app" {
organization = "your-org"
server_id = laravelforge_server.web.id
type = "php"
name = "app.example.com"
}That's it. Servers, sites, databases, daemons and SSL declared in HCL and reconciled by OpenTofu — not clicked together in a dashboard.
Important
Pre-1.0 / beta. Built against the new org-scoped Forge JSON:API. Reads are verified against the live API; writes (create/update/delete) are exercised by mock acceptance tests but not yet verified against the live API, and only scalar attributes are mapped — pin an exact version and test before relying on it.
terraform {
required_providers {
laravelforge = {
source = "kirchdev/laravelforge"
version = "~> 0.1"
}
}
}
provider "laravelforge" {
token = var.forge_token # or set FORGE_TOKEN
}
resource "laravelforge_site" "app" {
organization = "your-org"
server_id = data.laravelforge_server.web.id
type = "php"
name = "app.example.com"
php_version = "php82"
}export FORGE_TOKEN="forge_xxx" # Forge → Account → API
tofu plan- 🏗️ Forge as code — servers, sites, databases, daemons, scheduled jobs, SSL and more in HCL.
- 🧩 Full API coverage — ~57 resources + ~83 data sources across essentially every manageable Forge entity.
- 🚀 OpenTofu & Terraform — published as
kirchdev/laravelforgeon both registries. - 🔐 Simple auth — one Forge token via
tokenorFORGE_TOKEN. - ⚡ Modern stack —
terraform-plugin-framework; docs generated from the schema.
~57 resources + ~83 data sources covering essentially every manageable Forge entity (pure actions like reboot / restart / deploy-trigger are intentionally excluded).
Full coverage
- Servers — server, PHP versions & config (cli/fpm/pool/opcache, max upload & execution), network, logs.
- Sites — site, environment, deployments (script, key, push-to-deploy, history), commands, workers, redirect & security rules, SSL, load balancing, webhooks, and integration toggles (
octane,horizon,pulse,reverb,laravel-scheduler,laravel-maintenance,inertia). - Services — daemons (background processes), scheduled jobs, firewall rules, databases, database users, database backups, nginx templates, monitors, SSH keys.
- Organization — teams, roles & permissions, recipes, storage providers, server credentials, VPCs.
- Data sources — a read for everything above plus providers / regions / sizes, organizations and the current user.
Per-resource docs live under docs/, generated from the schema with make docs (build + export schema + tfplugindocs).
PRs welcome. Conventional Commits required (enforced via commitlint). Husky runs the linters/formatters on git commit.
Tip
Run make build && go vet ./... before pushing — CI will catch what husky missed.
See CONTRIBUTING.md for the full workflow.
Semantic Versioning via release-please — see CHANGELOG.md.