Terraform Provider

Hatchet's terraform provider allows you to automate administrative tasks on your tenants.

Creating a management token

The first step is creating a management token. Unlike API tokens, management tokens are not bound to a tenant but rather an organization. Because they can take administrative actions on tenants, you can also specify tags, which limit which tenants a management token can affect. A management token with tags can only act on tenants whose tags are a subset of those on the token. It cannot access untagged tenants or manage user groups, and it must set at least one tag on any tenant it creates.

Management tokens settings page
Management token creation modal
Newly created management token

Examples

Configure the provider

export HATCHET_CLOUD_MANAGEMENT_TOKEN="<your-management-token>"
terraform {
  required_providers {
    hatchet = {
      source  = "hatchet-dev/hatchet"
      version = "~> 1.1"
    }
  }
}

provider "hatchet" {
  # The token will either come from the HATCHET_CLOUD_MANAGEMENT_TOKEN env var, or it can be manually supplied here.
  # We recommend using the env var in production.
  # token = "eyJhbGciOiJFUzI1NiIs..."
}

Create a tenant

Changing a tenant's name, slug, or region deletes the tenant and creates a new one. Changing tags does the same if slug or region is not set. Set prevent_destroy to block this, and review terraform plan before applying.

resource "hatchet_tenant" "production" {
  name   = "Production"
  slug   = "acme-production"
  region = "aws:us-west-2"

  lifecycle {
    prevent_destroy = true
  }
}

Create a tenant API token

Each later terraform apply revokes this token and creates a new one. Update any workers that use it with the new value.

resource "hatchet_tenant_api_token" "worker" {
  tenant_id  = hatchet_tenant.production.id
  name       = "worker"
  expires_at = "720h"
}

output "worker_token" {
  value     = hatchet_tenant_api_token.worker.token
  sensitive = true
}

Invite an organization member

resource "hatchet_organization_member" "jane" {
  email = "jane@example.com"
  role  = "MEMBER"
}

Create a user group

resource "hatchet_user_group" "platform_admins" {
  name = "platform-admins"
  role = "ADMIN"
  tags = ["platform"]
}

Last updated on December 3, 2026

On this page