Automate
Terraform and OpenTofu
The Unrent provider manages your organisation as code through the public API (https://api.unrent.dev/v1): projects, environments, services from an image or a repository, variables, schedules, databases and their links, domains, storage targets, notification channels, the status page and project roles, with import and drift detection. Secret values are write-only and sealed to your server before they leave your machine.
Configure
terraform {
required_providers {
unrent = { source = "pilotaai/unrent" }
}
}
provider "unrent" {} # UNRENT_TOKEN: a personal token with read, deploy and manage
resource "unrent_service" "web" {
environment = "production"
name = "web"
server_id = data.unrent_servers.all.servers[0].id
image = "ghcr.io/acme/web:1.4.2"
port = 8080
health_check_path = "/healthz"
}Create an API token under Settings → Access → Automation with the read, deploy and manage scopes. In GitHub Actions, github_actions { environment = "production" } exchanges the job’s OIDC token, so CI stores no Unrent secret.
The provider is on the Terraform Registry and the OpenTofu Registry as pilotaai/unrent: terraform init or tofu init installs it and checks its signature. Each release’s source and signed zips are on GitHub.
Coming The published version, 0.1.0, has 18 resources (unrent_project, unrent_project_role, unrent_environment, unrent_environment_protection, unrent_environment_template, unrent_branch_environments, unrent_service, unrent_service_variables, unrent_variables, unrent_cron, unrent_database, unrent_database_link, unrent_domain, unrent_storage_target, unrent_notification_channel, unrent_status_page, unrent_status_component, unrent_sandbox_settings) and 6 data sources (unrent_project, unrent_environments, unrent_servers, unrent_members, unrent_releases, unrent_sandboxes). The other resources on this page come with the next release.
Deletes wait for a passkey
Destroying a service or a database, any storage-target change, and changes in an environment with an approval floor are jobs a person approves with a passkey. The provider waits for the approval (15 minutes by default, approval_timeout), or fails with the approval page and the digest the passkey signs. It never approves anything itself.
Secrets never reach the state
Secret values go in write-only attributes such as secrets_wo (Terraform and OpenTofu 1.11 or later). The provider seals each value to the server’s public key on your machine; the plan and the state hold null, and the API never returns the value. Change secrets_version to send new values.
resource "unrent_service_variables" "web" {
environment = "production"
service = "web"
variables = { LOG_LEVEL = "info" }
secrets_wo = { STRIPE_KEY = var.stripe_key } # an ephemeral variable
secrets_version = "1"
}Import and drift
Every resource imports by its natural id, such as tofu import unrent_service.web production/web. A refresh compares each resource with what Unrent reports, so a change made in the console shows up in the next plan.
Questions
Which resources are there?
Project, project role, environment, service, service variables, cron, database, database link, domain, storage target, notification channel, status page and status component; data sources for servers, releases, a project and members.
Can the provider skip an approval?
No. It talks only to the public API, which holds those jobs for a passkey whatever the token.
Updated . This page as Markdown.