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 withgetToken.
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 totrueto 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 exampleRS256orHS256.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