Catalogue
I Built a Terraform Provider for Managing Langfuse Configuration

I Built a Terraform Provider for Managing Langfuse Configuration

🌐 日本語で読む

I built kenzo0107/terraform-provider-langfuse, a Terraform provider for managing Langfuse projects, members, prompts, and evaluation settings, and published it to the Terraform Registry. It covers 18 resources and 1 data source, letting you turn Langfuse admin-console configuration into code.

Why I built this

Langfuse lets you click through project creation, member invitations, prompt management, and evaluation settings in the Web UI. But as the number of environments grows and you want configuration you can review as a diff, the UI alone starts to fall short in a few ways:

  • Keeping settings consistent across multiple projects (dev / staging / production) is hard to do by hand
  • There’s no easy way to review who changed what via a pull request
  • Project API keys, LLM connections, and custom model pricing end up managed outside the same IaC workflow you already use for other resources (e.g. AWS)

As of July 2026, Langfuse didn’t offer an official Terraform provider, so I built one myself against the Langfuse Public API, implemented with the Terraform Plugin Framework.

kenzo0107/terraform-provider-langfuse

What it covers: resources and data sources

As of now it covers 18 resources and 1 data source.

Projects and authentication

ResourcePurpose
langfuse_projectCreate and manage projects
langfuse_project_api_keyIssue project API keys (secret_key is only available at creation time)

The langfuse_project data source lets you look up an existing project.

Members and access management

ResourcePurpose
langfuse_organization_memberManage a member’s role within the organization (OWNER/ADMIN/MEMBER/VIEWER)
langfuse_project_memberManage a member’s role within a project (the user must already be an organization member)
langfuse_scim_userManage users via SCIM (requires an organization-scoped API key with SCIM permissions)

Prompts and datasets

ResourcePurpose
langfuse_promptManage prompts. Each update creates a new version
langfuse_datasetManage datasets (the API doesn’t support deletion, so destroy only removes it from Terraform state)
langfuse_dataset_itemManage items within a dataset

Evaluation and scoring

ResourcePurpose
langfuse_scoreRecord a score (all attributes are immutable; any change forces a re-create)
langfuse_score_configDefine scoring criteria (deletion is unsupported; destroy archives it instead)
langfuse_evaluatorDefine an evaluator such as LLM-as-a-Judge (⚠️ uses Langfuse’s unstable /api/public/unstable/ API)
langfuse_evaluation_ruleA rule that applies an evaluator to traces (⚠️ also uses the unstable API)
langfuse_annotation_queueAn annotation queue for human review
langfuse_annotation_queue_itemA trace/observation added to a queue
langfuse_commentA comment on a trace, observation, session, or prompt (the API doesn’t support updating or deleting comments)

Integrations and cost tracking

ResourcePurpose
langfuse_llm_connectionLLM connections used by the Playground / evaluations (OpenAI, Azure OpenAI, etc.)
langfuse_blob_storage_integrationData export configuration to S3 / GCS, etc. (access_key_id / secret_access_key are write-only)
langfuse_custom_modelCustom model definitions for cost tracking (pricing and match pattern)

Usage

It’s published on the Terraform Registry, so you can start using it right away by adding it to required_providers.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
terraform {
required_providers {
langfuse = {
source = "kenzo0107/langfuse"
version = "~> 0.2"
}
}
}

provider "langfuse" {
public_key = var.langfuse_public_key
secret_key = var.langfuse_secret_key
# host = "https://cloud.langfuse.com" # default if omitted; change for self-hosted
}

resource "langfuse_project" "example" {
name = "my-project"
}

resource "langfuse_project_api_key" "example" {
project_id = langfuse_project.example.id
note = "CI/CD pipeline key"
}

Authentication uses Basic Auth via public_key / secret_key (or the LANGFUSE_PUBLIC_KEY / LANGFUSE_SECRET_KEY environment variables). Changing host also lets you target a self-hosted instance.

Implementation notes

  • Implemented in Go 1.24 with the Terraform Plugin Framework
  • internal/provider/ holds the per-resource implementations; langfuse/ is a separate HTTP client for the Langfuse Public API
  • Documentation is auto-generated into docs/ via go generate (tfplugindocs)
  • CI runs go build and static analysis, plus make testacc (acceptance tests)

A note on testing

I haven’t written acceptance tests for langfuse_organization_member, langfuse_project_member, or langfuse_scim_user.

Depending on your Langfuse plan (e.g. Hobby), you may not be able to invite additional members to an organization at all, so I couldn’t set up a state with multiple members and verify these resources against the real API. The CRUD implementations themselves just call the API as documented, but I want to be upfront that I haven’t actually confirmed the full “invite another member → change role → remove” flow end to end.

If I get access to a higher-tier plan that allows inviting multiple members, I plan to add tests. If you try these resources and run into issues, please open an issue.

What I’d like to improve

  • langfuse_evaluator / langfuse_evaluation_rule depend on the unstable API, so they’ll need to track any changes Langfuse makes there
  • Acceptance tests for the member-related resources, if a plan that allows it becomes available
  • Cleaning up import support gaps (some, like project_api_key, are unavoidable due to API constraints)

Summary

  • I built a Terraform provider wrapping the Langfuse Public API and published it to the Terraform Registry

  • It covers 18 resources and 1 data source, from projects and members to prompts, datasets, evaluation, and integrations

  • The three member-invitation-related resources skip real-API acceptance tests due to plan limitations

  • The source is public, so if you want to manage Langfuse configuration as code, give it a try

  • Repository: kenzo0107/terraform-provider-langfuse

  • Terraform Registry: registry.terraform.io/providers/kenzo0107/langfuse

kenzo0107

kenzo0107