clickhouse_postgres_service resource in the ClickHouse Terraform provider. This page covers provider setup and configuration examples for the resource and its companion data sources.
This resource is in alpha and its behavior may change in future provider versions. It ships in the regular provider build and is available from provider version v3.17.1 — check the provider releases for details.
Provider setup
Add the ClickHouse provider to your Terraform configuration:Resource overview
Theclickhouse_postgres_service resource has the following arguments:
The following attributes are read-only and populated by ClickHouse Cloud after creation:
id, state, created_at, is_primary, hostname, port, username, and connection_string (sensitive).
Create a service
password — it must be at least 12 characters with at least one lowercase letter, one uppercase letter, and one digit. Omit it and the server generates one.
High availability
Theha_type argument controls the number of standby replicas:
ha_type is mutable post-create; changing it triggers an HA transition. See High availability for details.
Read replicas
Setread_replica_of to the id of a primary service to create a streaming read replica. A replica inherits the primary’s cloud_provider, region, postgres_version, and superuser — omit those (and password):
Point-in-time restore
Setrestore_to_point_in_time to create a service by restoring another service’s backup to a point in time. cloud_provider, region, and postgres_version are inherited from the source (omit them); size and ha_type must be omitted:
source_id or restore_target, or removing the block, destroys and recreates the service. See Backup and restore for details.
Data sources
Three companion data sources let you look up existing services:Importing existing services
Existing Managed Postgres services can be imported into Terraform state using the service ID. The password is recovered on import — the server echoes it onGET:
Unsupported operations
The following are intentionally absent from the resource schema:- Operational commands (restart, promote, switchover).
- IP allowlists, private endpoints, backup configuration, maintenance windows, customer-managed encryption keys, and BYOC.
- Configurable lifecycle timeouts — there is no
timeouts {}block.