Skip to main content
The provider drives the same REST API as the dashboard and CLI, with your own token, so every policy and approval rule still applies. It lives in its own Go module, integrations/terraform-provider/, and never ships inside the control plane binary. The provider is listed on the Terraform registry and the OpenTofu registry as glincker/levelrail. Use the required_providers block under Configure below and run terraform init or tofu init.

Installing from source

To run a build from this repository instead of the registry release, build it and point the CLI at the binary with dev_overrides:
With dev_overrides skip terraform init for this provider and run plan and apply directly. Without the override, the source = "registry.terraform.io/glincker/levelrail" address in the example below downloads the registry release. The release plan is in integrations/terraform-provider/release/README.md.

Where the name lives

Everything that carries the product name is in one file, integrations/terraform-provider/internal/provider/brand.go: the resource prefix, the registry address, and the environment variable names. A rename is that one edit plus the module path in integrations/terraform-provider/go.mod. Resource type names are built from the prefix at runtime, so no other Go file repeats it.

Configure

url and token fall back to the APP_API_URL and APP_API_TOKEN environment variables, the same ones the CLI reads. Prefer the variables over writing the token into a file.

Resources

Data sources: levelrail_apps lists every app with its image, port, project and domains. levelrail_nodes lists the fleet and needs a root token. levelrail_app_secrets lists the secret key names, lock and age of one app, never values. levelrail_cron_jobs lists every scheduled job of one app, with the path and method of http jobs. levelrail_projects lists every project with its id and name.

Coverage

Gap analysis of what each resource exposes against what the REST API and the IaC kinds support. “Not covered” means the API has it but it is not stable in the IaC schema yet, or it has no stable route. Every resource supports terraform import, treats a 404 on read as drift (removed from state), and reads the live object after each write. Lists, sets and maps on levelrail_app (command, labels, published ports, volumes, tags, exec probes, env) are managed only when set, so leaving one unset never wipes what the dashboard configured; a resource that is imported shows them as unset until you add them to the configuration. Memory and CPU use friendly units: memory_mb (MiB) and cpus (fractions allowed, 0.5 is half a CPU). The older memory_bytes and nano_cpus still work and are deprecated; set only one of each pair. Volumes are applied through the volumes route and tags are lowercase key or key:value.

Complete example

Behavior worth knowing

  • levelrail_app and levelrail_domain both write the app’s domain list. Manage hostnames only with levelrail_domain, never through the app resource, which does not expose them.
  • levelrail_app.env is sensitive and, when set, replaces the live plain variables. Leave it unset to manage variables elsewhere.
  • levelrail_environment_variables only manages the keys you list. Other variables at that scope are left alone, and deleting the resource removes only its own keys.
  • Database engine and version never change in place. A change forces a replace, which destroys data, so use prevent_destroy on databases you care about.
  • Deleting a project follows the API’s own guard and is refused while it still holds apps.
  • levelrail_status_page is a singleton. Destroying it turns the page off and clears its fields. See examples/terraform-provider/status-page.tf.
  • levelrail_status_component is matched by ID, so a component deleted outside Terraform is planned for re-creation. Status incidents are not managed.

Settings, node labels and tokens

  • levelrail_setting writes through the same validation as the CLI. A change that weakens a security protection is refused until you confirm it in the CLI or dashboard, and settings marked sensitive are refused outright, so a credential never lands in state. Destroying the resource resets the key to its default. Writing settings needs a root token.
  • levelrail_node_labels never creates or deletes a node. It owns only the label keys and the taints (key plus effect) you list: others set from the CLI are left alone and never show as drift, and destroy removes only what the resource set. Importing by node name adopts every label and taint the node has.
  • There is no token resource. The API only lets an interactive session create or revoke tokens, never a bearer token, so a provider holding a token cannot mint another one. Create tokens in the dashboard or CLI and pass them in as variables.

Retries

Requests are retried with exponential backoff and jitter on 429, 5xx and connection resets, honoring Retry-After. Only safe requests are retried: GET, HEAD, PUT and DELETE, and POST only when it carries an Idempotency-Key. A 4xx other than 429 is never retried. Tune it with max_retries (default 4, 0 turns it off) and retry_wait_max_seconds (default 30, which also caps a long Retry-After) in the provider block.

What is not covered

  • Vault-backed variables (vault_env) and bulk secret import. Single secret values can be set with levelrail_app_secret, but they land in Terraform state, so protect the state.
  • Volumes, bind mounts, hooks, exec and TCP probes, egress policy, GPU requests and placement on apps.
  • Git and build sources, deploys and rollbacks (these are actions, not state).
  • Per-domain settings such as TLS certificates, redirects, headers, WAF, caching and auth gates.
  • Creating or removing nodes (the levelrail_nodes data source reads them), load balancers, pipelines, notification channels, backups, teams, users, roles and tokens.
  • Database users, backup schedules, placement, public access and upgrades.
For several of these, Platform as code covers them through the CLI.

Acceptance tests

They need a terraform or tofu binary and a live control plane, and are off unless TF_ACC=1. The recipe in scripts/smoke.sh starts a dev mode control plane with no Docker (SMOKE_KEEP=1 leaves it running and prints the URL):
The database resource has no acceptance test because creating a database needs a Docker host.
Last modified on November 17, 2026