Test mode: paid plans aren't on sale yet, so nothing is charged. Every plan's limits apply.

← Docs

Nod provider for Terraform and OpenTofu

Manages one Nod realm through its management API: APIs, roles, clients and their grants on APIs, organizations, connections (outside providers), and the FGA model.

provider "harpora" {
  issuer        = "https://auth.example.com/acme"   # or HARPORA_ISSUER / NOD_ISSUER
  client_id     = "terraform"                       # or HARPORA_CLIENT_ID / NOD_CLIENT_ID
  client_secret = var.harpora_secret                # or HARPORA_CLIENT_SECRET / NOD_CLIENT_SECRET
}

resource "harpora_api" "ledger" {
  identifier = "https://ledger.example"
  scopes     = ["read", "write"]
}

resource "harpora_client" "billing" {
  client_id = "billing"
  machine   = true
}

resource "harpora_client_grant" "billing_ledger" {
  client_id = harpora_client.billing.client_id
  resource  = harpora_api.ledger.identifier
  scopes    = ["read"]
}

The provider's own client is a machine client of the realm, registered and granted from the command line (the management API never grants its own scopes):

nod client register acme terraform --machine
nod client grant acme terraform https://auth.example.com/acme/api \
  --scope apis:read --scope apis:write --scope roles:read --scope roles:write --scope clients:read \
  --scope clients:write --scope organizations:read --scope organizations:write --scope fga:admin --scope fga:read \
  --scope connections:read --scope connections:write

harpora_realm, harpora_text and harpora_hook also need --scope realm:read --scope realm:admin. realm:admin reaches the realm's other settings too, so grant it only when the configuration manages them.

ResourceNotes
harpora_apiCan't be destroyed while a client grant or a role names it: destroy those first (Terraform's dependency order does this when they're in the same configuration).
harpora_rolepermission blocks: scopes on APIs. A destroyed role's name can't be used again: assignments to it may remain, and a new role must not inherit them.
harpora_clientthird_party: people are asked for consent first. A confidential or machine client's client_secret is in the state, marked sensitive: keep the state as secret as the secret. Type (confidential, machine) changes replace the client. metadata as for organizations. organization_usage: allow (default), require or deny.
harpora_client_grantA machine client's scopes on one API. Import id: client_id\|resource.
harpora_organizationIts connections, auto-membership, branding and metadata (strings, sent to hooks; keys removed from the map are removed; left out, it isn't managed here).
harpora_fga_modelOne per realm. Destroying it leaves the last model in place.
harpora_connectionAn outside provider (kind: oidc, github, oauth2, ldap or saml), with the settings nod connection add takes. Changing any but disabled and scopes replaces it; one an organization lists can't be destroyed until the organization drops it. client_secret is never read back (import ignores it): keep it in a variable.
harpora_realmThe realm's own settings and branding (display_name, passwords_enabled, sign_up_enabled, bot_detection, email_codes, adaptive_mfa, logo_url, accent_color, background_color, sign_in_heading, terms_url, privacy_url). One per realm. A setting left out keeps the realm's value; destroying it leaves the realm as it is. Import id: realm.
harpora_hookA hook for one trigger (post-login, pre-registration, credentials-exchange, post-change-password, password-migration): its url (https to a public address) and fail_open. secret (sensitive) is the signing secret, new after every change, so a change shows it as known after apply: give it to your hook's own configuration from there. Import by the trigger (an imported hook has no secret until its next change).
harpora_textThe sign-in page's wording in one language (lowercase, as de or pt-br): a text map from key to one line of plain text. Keys it leaves out show the English default. Changing the language replaces it; destroying it puts the defaults back. Import by the language.

Imports: terraform import harpora_api.ledger https://ledger.example, and the client id, role name or organization id for the others.

Not published to a registry yet: that's a person's decision. Build it (go build) and point a dev_overrides block at it.

Its address is lunaor.com/lunaor/nod (since 4 Dec 2026, when the repository became lunaor/nod; before that lunaor.com/lunaor/harpora). A configuration on the old address: change required_providers' source and the dev_overrides key, then terraform state replace-provider lunaor.com/lunaor/harpora lunaor.com/lunaor/nod.

Tests

The acceptance tests drive the provider with OpenTofu (or Terraform) against a real nod serve on a throwaway PostgreSQL:

TF_ACC=1 TF_ACC_TERRAFORM_PATH=$(which tofu) TF_ACC_PROVIDER_HOST=registry.opentofu.org \
  TF_ACC_PROVIDER_NAMESPACE=hashicorp go test ./internal/provider/

Pinned: terraform-plugin-framework 1.19.0, terraform-plugin-testing 1.16.0 (MPL-2.0). Tested with OpenTofu 1.13.9.