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
NOTE: Write-only arguments are supported in Terraform 1.11 and later.
allowed_clock_skew(Number) Allowed clock skew in seconds. Defaults to5.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. Defaults tofalse.lifetime(Number) Token lifetime in seconds. Defaults to60.signing_algorithm(String) Signing algorithm, for exampleRS256orHS256. Defaults toRS256.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. If you remove it, Clerk keeps the last key; setcustom_signing_key = falseto stop using it. To keep the key out of the state, usesigning_key_woinstead.signing_key_wo(String, Sensitive, Write-only) Write-only form ofsigning_key. Terraform keeps it out of the plan and the state. It needs Terraform 1.11 or later. Do not set it together withsigning_key. A new value reaches Clerk only whensigning_key_wo_versionchanges.signing_key_wo_version(Number) Version ofsigning_key_wo. Change it to send the currentsigning_key_wovalue to Clerk. It needssigning_key_wo.
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