# terraform-provider-clerk

> Terraform provider for Clerk. JWT templates, restrictions, API keys, machines, domains, webhooks, organizations, SSO.

- status: maintained
- language: Go
- version: v0.7.0
- license: MIT
- registry: vanillauys/clerk
- repo: https://github.com/vanillauys/terraform-provider-clerk

Clerk is a hosted auth platform. This provider manages the
configuration of a Clerk instance through the Clerk Backend API: JWT
templates, redirect URLs, sign-up restrictions, API keys, machines,
domains, webhooks, organizations, and SSO.

Both providers here share the same skeleton: the Terraform plugin
framework, a thin API client, and acceptance tests that run against
the real service in CI.

## Usage

```hcl
terraform {
  required_providers {
    clerk = {
      source  = "vanillauys/clerk"
      version = "~> 0.7"
    }
  }
}

provider "clerk" {
  # secret_key falls back to the CLERK_SECRET_KEY environment variable
  secret_key = var.clerk_secret_key
}
```

One provider block targets one Clerk instance. Use a provider alias
for a second instance, for example dev and prod.

The full reference is at [/docs/clerk](/docs/clerk): every resource,
data source, and guide.

## For agents

- Install from the Terraform registry: source `vanillauys/clerk`. The
  provider is pre-1.0; pin an exact version if you need stability.
- Authenticate with the instance secret key (`sk_test_...` or
  `sk_live_...`) in `secret_key`, or set the `CLERK_SECRET_KEY`
  environment variable.
- Read the reference at `https://wihan.dev/docs/clerk`. Append `.md`
  to any docs URL for raw markdown, for example
  `https://wihan.dev/docs/clerk/resources/webhook.md`.
- Read the guides first:
  [getting started](/docs/clerk/guides/getting-started),
  [dev and prod instances](/docs/clerk/guides/dev-and-prod-instances),
  [adopting an existing instance](/docs/clerk/guides/adopting-an-existing-instance),
  and [secrets](/docs/clerk/guides/secrets).
- Known traps: the instance-level singletons adopt on create and never
  delete the instance; some fields are write-only, so the provider
  cannot see dashboard drift on them; the state file holds secrets.
- Source and issues:
  [github.com/vanillauys/terraform-provider-clerk](https://github.com/vanillauys/terraform-provider-clerk).