Terraform & OpenAPI for ClickPipes is now Generally Available

Apr 20, 2026 · 8 minutes read

Provision and manage ClickPipes resources “as code” using Terraform and OpenAPI, now with full connector coverage and improved usability.

ClickOps (i.e. clicking buttons in a user interface) is useful for onboarding into a new product, but as you progress towards production, it’s common to switch to an approach that allows managing resources in a more automated and version-controlled way: “infrastructure-as-code”.

As we build out ClickHouse Cloud, one of our goals is to make it API-first: every action you can perform through the user interface should also be available via a programmatic interface that can blend into your existing deployment workflows (and be leveraged by agents 🤖). ClickPipes, ClickHouse Cloud’s managed data ingestion platform, is no exception.

Get started today

Sign up for ClickHouse Cloud today to try out seamless data ingestion with ClickPipes!

Today, we’re announcing the general availability of ClickPipes resources in Terraform and endpoints in OpenAPI! Although we introduced beta support for these interfaces last year, there were some feature and usability gaps that prevented all users from managing their ClickPipes as code. Most notably, we were missing full connector coverage: well, now you can also create CDC ClickPipes (Postgres, MySQL, MongoDB) as code, too!

What is supported? #

In addition to support for CDC ClickPipes, we’ve worked on adding new ClickPipes connectors and features to both interfaces on launch (e.g. BigQuery and Azure Blob Storage connectors, S3 and GCS unordered mode), as well as backfilling important gaps like support for creating and managing reverse private endpoints. This means that you’re unlikely to find something in the ClickPipes UI that isn’t exposed via OpenAPI or Terraform. Unless that something is SSH tunneling, but we’re working on it!

Every operation now cleanly maps to a resource in the ClickHouse Terraform provider or an OpenAPI endpoint:

ActionTerraformOpenAPI
Listterraform state listGET /clickpipes
CreateAdd resource + terraform applyPOST /clickpipes
Readterraform show / refreshGET /clickpipes/{id}
UpdateChange config + terraform applyPATCH /clickpipes/{id}
Stopstopped = true + terraform applyPATCH /clickpipes/{id}/state {"action": "stop"}
Resumestopped = false + terraform applyPATCH /clickpipes/{id}/state {"action": "start"}
Update settingsUpdate settings block + terraform applyPUT /clickpipes/{id}/settings
ScaleUpdate scaling block + terraform applyPATCH /clickpipes/{id}/scaling
Trigger resynctrigger_resync = true + terraform applyPATCH /clickpipes/{id}
Deleteterraform destroyDELETE /clickpipes/{id}

If you're provisioning a ClickPipe from scratch, start with How to: configure a new ClickPipe. If you already have pipes running and want to bring them under version control, check How to: import existing ClickPipes.

How to: configure a new ClickPipe #

Create a Cloud API key #

1. The ClickHouse Terraform provider uses the Cloud API to interact with your ClickHouse Cloud service, so you’ll need a valid API key for authentication. If you’re new to the provider, the first step is to create a new API key. Navigate to Organization > API keys > New API key, and note (or download) the provided Key ID and a Key Secret pair.

2. Next, configure the provider. To keep credentials out of source control, we recommend using Terraform variables and a terraform.tfvars file that you can add to .gitignore:

variables.tf

1variable "organization_id" {
2  description = "ClickHouse Cloud organization ID"
3  type        = string
4}
5
6variable "service_id" {
7  description = "ClickHouse Cloud service ID"
8  type        = string
9}
10
11variable "token_key" {
12  description = "ClickHouse Cloud API key ID"
13  type        = string
14  sensitive   = true
15}
16
17variable "token_secret" {
18  description = "ClickHouse Cloud API key secret"
19  type        = string
20  sensitive   = true
21}
22...

terraform.tfvars

1organization_id   = "" # your org ID from cloud.clickhouse.com
2service_id        = "" # target ClickHouse service ID
3token_key         = "" # API key ID
4token_secret      = "" # API key secret
5...

Configure a ClickPipes resource #

In this example, we’ll configure a resource for a Postgres CDC ClickPipe to continuously ingest changes from a Postgres database into ClickHouse in near real time. Remember: before creating a CDC ClickPipe, make sure to follow the configuration guides for your data source, which guide you through enabling replication upstream.

1. Once you’re ready to create a ClickPipe, add a new clickhouse_clickpipe resource to your Terraform configuration using postgres as the source attribute. Below is a basic configuration example that creates a single ClickPipe to sync a single Postgres table (public.firenibble) and propagate any new changes in the source_table (i.e. inserts, updates, deletes) to the target_table in ClickHouse Cloud using cdc.

main.tf

1terraform {
2 required_providers {
3   clickhouse = {
4     source  = "ClickHouse/clickhouse"
5     version = ">= 3.14.0"
6   }
7 }
8}
9
10provider "clickhouse" {
11 organization_id = var.organization_id
12 token_key       = var.token_key
13 token_secret    = var.token_secret
14}
15
16resource "clickhouse_clickpipe" "pg_pipe" {
17 name       = "tf-postgres-clickpipe"
18 service_id = var.service_id
19
20 source = {
21   postgres = {
22     host     = var.postgres_host
23     port     = 5432
24     database = var.postgres_database
25
26     credentials = {
27       username = var.postgres_user
28       password = var.postgres_password
29     }
30
31     settings = {
32       replication_mode = "cdc"
33     }
34
35     table_mappings = [
36       {
37         source_schema_name = "public"
38         source_table       = "firenibble"
39         target_table       = "public_firenibble"
40       }
41     ]
42   }
43 }
44
45 destination = {
46   database = "default"
47 }
48}

2. Now that you’ve passed your Cloud API credentials and resource configuration to Terraform, you’re ready to deploy. Run terraform init to install the ClickHouse provider, then terraform apply to provision the pipe. Terraform will output a plan and prompt you to confirm the planned changes before deploying:

1terraform apply
2
3...
4Plan: 1 to add, 0 to change, 0 to destroy.
5
6Do you want to perform these actions?
7  Terraform will perform the actions described above.
8  Only 'yes' will be accepted to approve.
9
10  Enter a value: yes
11
12clickhouse_clickpipe.pg_pipe: Creating...
13clickhouse_clickpipe.pg_pipe: Still creating... [00m10s elapsed]
14clickhouse_clickpipe.pg_pipe: Creation complete after 11s [id=10128f88-100c-4830-b480-e242fa89570f]

All done! Your first CDC ClickPipe created programmatically is now up and running. Head over to the ClickHouse Cloud console and double-check it is indeed there (under Data sources > ClickPipes), churning through data ingestion.

You can find examples on how to configure ClickPipes in Terraform for different pipe types, ingestion modes and network setups in the provider repo.

How to: import existing ClickPipes #

The following steps were tested with HashiCorp Terraform v1.5+. The import workflow should be broadly compatible with alternative implementations (e.g. OpenTofu), but minimum versions and base methods might differ.

If you already have a project that uses the ClickHouse Terraform provider, you can import existing ClickPipes into your Terraform state and start managing them as code, instead of manually configuring them.

1. Use the Cloud API to retrieve existing ClickPipes for the organization and service in scope:

curl -s \
  "https://api.clickhouse.cloud/v1/organizations/$ORG_ID/services/$SERVICE_ID/clickpipes" \
  -u "$KEY_ID:$KEY_SECRET" | jq -r '.result[] | "\(.id)\t\(.name)"'

1667855d-1646-4693-8cac-60e1c386ccb1    existing_pg_pipe
2e4c3974-025e-47a0-861b-4c200b6c0249    existing_mysql_pipe
76a42195-ef25-40fc-ae3d-31733d377f77    existing_mongo_pipe

2. Edit your configuration file to include import blocks for any ClickPipes you want to import into Terraform:

1...
2import {
3  to = clickhouse_clickpipe.existing_pg_pipe
4  id = "<service_id>:1667855d-1646-4693-8cac-60e1c386ccb1"
5}
6...

3. Generate the Terraform resource configuration from the existing resources:

terraform plan -generate-config-out=generated.tf

Review generated.tf and fill in any sensitive fields (like credentials) that Terraform can't retrieve from state.

1# __generated__ by Terraform
2# Please review these resources and move them into your main configuration files.
3
4# __generated__ by Terraform
5resource "clickhouse_clickpipe" "pg_pipe" {
67credentials    = {
8username = var.postgres_user
9password = var.postgres_password
10}
11…}

4. Run terraform plan to verify there are no unexpected diffs, then terraform apply to finalize.

Note: For Postgres CDC ClickPipes, you’ll need to set stopped = true in the resource config before running terraform apply. Terraform will pause the pipe and write credentials to state in one pass. Once complete, set stopped = false and apply again to resume. This is a known limitation.

What’s next? #

ClickPipes resources are available in stable releases of the ClickHouse Terraform provider from v3.14.0, and OpenAPI endpoints have also graduated out of beta (spec). As ClickPipes evolves, we’ll continue treating Terraform and OpenAPI as first-class interfaces that are part of our “definition of done”. We’re actively working on some complex usability limitations like the one mentioned above, as well as the much-requested support for SSH tunneling configuration!

If you have feedback or run into any snags while configuring and managing ClickPipes using Terraform and OpenAPI, reach out to our team. Soon, we’ll also make ClickPipes available in the recently released ClickHouse CLI; more on this in a few weeks!

Try ClickPipes today

Ready to eliminate your ETL complexity and reduce your data movement costs? Try ClickPipes today and experience a fully managed, native integration experience with ClickHouse Cloud — the world’s fastest analytics database.
Share this post

Subscribe to our newsletter

Stay informed on feature releases, product roadmap, support, and cloud offerings!
Loading form...