wihan/dev

docs /clerk / resources

markdown
browse the clerk docs

clerk_jwt_template (Resource)

A JWT template. A template defines the shape of the tokens that Clerk mints for a session, with custom claims and a custom lifetime.

Example Usage

resource "clerk_jwt_template" "api" {
  name     = "api"
  lifetime = 3600

  claims = jsonencode({
    role  = "{{user.public_metadata.role}}"
    email = "{{user.primary_email_address}}"
  })
}

Schema

Required

  • name (String) Template name. The name is the key that a frontend SDK uses with getToken.

Optional

  • allowed_clock_skew (Number) Allowed clock skew in seconds. The Clerk default is 5.
  • claims (String) JSON object with the custom claims. Values support the Clerk shortcodes, for example {{user.public_metadata.role}}. Defaults to {}.
  • custom_signing_key (Boolean) Set to true to sign tokens with your own key instead of the instance key.
  • lifetime (Number) Token lifetime in seconds. The Clerk default is 60.
  • signing_algorithm (String) Signing algorithm, for example RS256 or HS256.
  • signing_key (String, Sensitive) Private key for a custom signing key. Clerk never returns this value; the provider keeps the configured value in state and cannot detect server-side drift.

Read-Only

  • id (String) JWT template id.

Import

Import is supported using the following syntax:

The terraform import command can be used, for example:

terraform import clerk_jwt_template.api jtmp_2abcDEFghiJKLmnoPQRstuVWXyz