Skip to content

feat: add support for external ClickHouse instances#54

Open
guidev wants to merge 4 commits into
langfuse:mainfrom
guidev:feat/external-clickhouse
Open

feat: add support for external ClickHouse instances#54
guidev wants to merge 4 commits into
langfuse:mainfrom
guidev:feat/external-clickhouse

Conversation

@guidev
Copy link
Copy Markdown
Contributor

@guidev guidev commented Mar 5, 2026

Summary

  • Add clickhouse_deploy variable (default true) to toggle between bundled and external ClickHouse
  • When clickhouse_deploy = false, skip all EFS and ClickHouse PV/access point resources, and configure the Helm chart to connect to an external ClickHouse instance
  • Add variables for external ClickHouse configuration: clickhouse_host, clickhouse_http_port, clickhouse_native_port, clickhouse_database, clickhouse_user, clickhouse_password, clickhouse_ssl, clickhouse_cluster_enabled
  • Gate all EFS resources (file system, mount targets, security group, IAM policy/role, storage class) behind clickhouse_deploy
  • Zero breaking changes: existing deployments with default clickhouse_deploy = true continue to work identically

Motivation

The bundled ClickHouse deployment uses EFS for persistent storage, which incurs ~$400/month due to ClickHouse's write-heavy I/O patterns. Using an external ClickHouse instance (e.g. ClickHouse Cloud) eliminates the need for EFS entirely, significantly reducing costs while improving ClickHouse performance.

Test plan

  • terraform validate passes
  • terraform plan with clickhouse_deploy = true (default) shows no resource additions or deletions — only cosmetic Helm values restructuring and automatic [0] index moves
  • terraform plan with clickhouse_deploy = false + external ClickHouse vars shows EFS/ClickHouse resources removed and Helm values updated
  • Successfully applied with clickhouse_deploy = true on a live deployment confirming backward compatibility

🤖 Generated with Claude Code

Allow using an external ClickHouse instance (e.g. ClickHouse Cloud)
instead of the bundled Helm-managed ClickHouse backed by EFS. This
eliminates the need for EFS (~$400/month) for ClickHouse's
write-heavy workload.

When `clickhouse_deploy = false`, all EFS and ClickHouse PV resources
are skipped, and the Helm chart is configured to connect to the
external instance. Setting `clickhouse_deploy = true` (default)
preserves existing behavior with zero breaking changes.

New variables: clickhouse_deploy, clickhouse_host, clickhouse_http_port,
clickhouse_native_port, clickhouse_database, clickhouse_user,
clickhouse_password, clickhouse_ssl, clickhouse_cluster_enabled.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Comment thread clickhouse.tf
Without these, upgrading an existing deployment would destroy and
recreate the EFS file system (losing ClickHouse data), the random
ClickHouse password (breaking auth), and related IAM/SG resources
when their addresses gain a [0] index.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants