Terraform module which creates Yandex Cloud ClickHouse resources.
Fork of https://github.com/polina-yudina/terraform-yc-clickhouse
Examples codified under
the examples
are intended
to give users references for how to use the module(s) as well as testing/validating changes to the source code of the
module. If contributing to the project, please be sure to make any appropriate updates to the relevant examples to allow
maintainers to test your changes and to keep the examples up to date for users. Thank you!
Name | Version |
---|---|
terraform | >= 1.0.0 |
random | > 3.3 |
yandex | > 0.8 |
Name | Version |
---|---|
random | > 3.3 |
yandex | > 0.8 |
No modules.
Name | Type |
---|---|
random_password.password | resource |
yandex_mdb_clickhouse_cluster.this | resource |
yandex_client_config.client | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
access | (Optional) Access policy from other services to the ClickHouse cluster. Default: null |
object({ |
{} |
no |
admin_password | (Optional) A password used to authorize as user admin when sql_user_management enabled. Default: null |
string |
null |
no |
backup_window_start | (Optional) Time to start the daily backup, in the UTC timezone. Default: null |
object({ |
null |
no |
clickhouse_config | (Optional) Main ClickHouse cluster configuration. For more information, see the official documentation. Link 1: https://cloud.yandex.com/en-ru/docs/managed-clickhouse/concepts/settings-list Link 2: https://registry.terraform.io/providers/yandex-cloud/yandex/latest/docs/resources/mdb_clickhouse_cluster#config |
object({ |
null |
no |
clickhouse_disk_size | (Optional) Disk size for hosts. Default: 10 |
number |
10 |
no |
clickhouse_disk_type_id | (Optional) Disk type for hosts. Allowed types: - network-hdd - network-ssd - network-ssd-nonreplicated - local-ssd "local-ssd" restrictions: - For Intel Broadwell and Intel Cascade Lake: Only in increments of 100 GB. - For Intel Ice Lake: Only in increments of 368 GB. Default: "network-ssd" |
string |
"network-ssd" |
no |
clickhouse_resource_preset_id | (Optional) Preset for hosts. All types: https://cloud.yandex.com/en/docs/managed-clickhouse/concepts/instance-types Default: "s3-c2-m8" |
string |
"s3-c2-m8" |
no |
clickhouse_version | (Optional) ClickHouse version. Default: "23.8" |
string |
"23.8" |
no |
cloud_storage | - enabled - (Required) Whether to use Yandex Object Storage for storing ClickHouse data. Can be either true or false. - move_factor - (Optional) Sets the minimum free space ratio in the cluster storage. If the free space is lower than this value, the data is transferred to Yandex Object Storage. Acceptable values are 0 to 1, inclusive. - data_cache_enabled - (Optional) Enables temporary storage in the cluster repository of data requested from the object repository. - data_cache_max_size - (Optional) Defines the maximum amount of memory (in bytes) allocated in the cluster storage for temporary storage of data requested from the object storage. Default: null |
object({ |
null |
no |
copy_schema_on_new_hosts | (Optional) Whether to copy schema on new ClickHouse hosts. Default: false |
bool |
false |
no |
databases | (Required) A list of ClickHouse databases. Required values: - name - The name of the database. |
list(object({ |
[] |
no |
deletion_protection | (Optional) Inhibits deletion of the cluster. Default: false |
bool |
false |
no |
description | (Optional) ClickHouse cluster description. Default: null |
string |
null |
no |
embedded_keeper | (Optional, ForceNew) Whether to use ClickHouse Keeper as a coordination system and place it on the same hosts with ClickHouse. If not, it's used ZooKeeper with placement on separate hosts. Default: false |
bool |
false |
no |
environment | (Optional) Environment type: "PRODUCTION" or "PRESTABLE". Default: "PRODUCTION" |
string |
"PRODUCTION" |
no |
folder_id | (Optional) Folder id that contains the ClickHouse cluster. Default: null |
string |
null |
no |
format_schema | (Optional) A set of protobuf or capnproto format schemas. - name - (Required) The name of the ml model. - type - (Required) Type of the model. - uri - (Required) Model file URL. You can only use models stored in Yandex Object Storage. Default: null |
object({ |
null |
no |
hosts | (Required) A list of ClickHouse hosts. - type - (Required) The type of the host to be deployed. Can be either "CLICKHOUSE" or "ZOOKEEPER". - zone - (Required) The availability zone where the ClickHouse host will be created. Allowed values: "ru-central1-a", "ru-central1-b", "ru-central1-c". - subnet_id - (Optional) The ID of the subnet, to which the host belongs. The subnet must be a part of the network to which the cluster belongs. - shard_name - (Optional) The name of the shard to which the host belongs. - assign_public_ip - (Optional) Sets whether the host should get a public IP address on creation. Can be either true or false. |
list(object({ |
[] |
no |
labels | (Optional) A set of label pairs to assign to the ClickHouse cluster. Default: {} |
map(any) |
{} |
no |
maintenance_window | (Optional) Maintenance policy of the ClickHouse cluster. - type - (Required) Type of maintenance window. Can be either ANYTIME or WEEKLY. A day and hour of window need to be specified with weekly window. - day - (Optional) Day of the week (in DDD format). Allowed values: "MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN" - hour - (Optional) Hour of the day in UTC (in HH format). Allowed value is between 0 and 23. Default: {type = "ANYTIME"} |
object({ |
{ |
no |
ml_model | (Optional) A group of machine learning models. - name - (Required) The name of the ml model. - type - (Required) Type of the model. - uri - (Required) Model file URL. You can only use models stored in Yandex Object Storage. Default: null |
object({ |
null |
no |
name | (Optional) Name of ClickHouse cluster. Default: "clickhouse-cluster" |
string |
"clickhouse-cluster" |
no |
network_id | (Required) ClickHouse cluster network id | string |
n/a | yes |
security_group_ids | (Optional) A list of security group IDs to which the ClickHouse cluster belongs. Default: [] |
list(string) |
[] |
no |
shard_group | (Optional) A group of clickhouse shards. - name - (Required) - The name of the shard group, used as cluster name in Distributed tables. - shard_names - (Required) - List of shards names that belong to the shard group. - description - (Optional) - Description of the shard group. Default: null |
object({ |
null |
no |
shards | - name - (Required) The name of shard. - weight - (Optional) The weight of shard. - resources - (Optional) Resources allocated to host of the shard. The resources specified for the shard takes precedence over the resources specified for the cluster. . - resource_preset_id - Preset for hosts. - disk_size - Disk size for hosts - disk_type_id - Disk type for hosts. One of: "network-hdd", "network-ssd", "network-ssd-nonreplicated", "local-ssd". Default: [] |
list(object({ |
[] |
no |
sql_database_management | (Optional, ForceNew) Grants admin user database management permission. Default: false |
bool |
false |
no |
sql_user_management | (Optional, ForceNew) Enables admin user with user management permission. Default: false |
bool |
false |
no |
users | (Required) This is a list for additional ClickHouse users with own permissions. Required values: - name - The name of the user. - password - The user's password. If it's omitted a random password will be generated Optional values: - permission - Set of permissions granted to the user. . - database_name - (Required) The name of the database that the permission grants access to. - settings - Custom settings for user. The list is documented below. All options by link: https://registry.terraform.io/providers/yandex-cloud/yandex/latest/docs/resources/mdb_clickhouse_cluster#settings - quota - Set of user quotas. . - interval_duration - (Required) Duration of interval for quota in milliseconds. - queries - (Optional) The total number of queries. - errors - (Optional) The number of queries that threw exception. - result_rows - (Optional) The total number of rows given as the result. - read_rows - (Optional) The total number of source rows read from tables for running the query, on all remote servers. - execution_time - (Optional) The total query execution time, in milliseconds (wall time). |
list(object({ |
[] |
no |
zookeeper_disk_size | (Optional) Volume of the storage available to a ZooKeeper host, in gigabytes. Default: 0 |
number |
0 |
no |
zookeeper_disk_type_id | (Optional) Type of the storage of ZooKeeper hosts. Allowed types: - network-hdd - network-ssd - network-ssd-nonreplicated - local-ssd "local-ssd" restrictions: - For Intel Broadwell and Intel Cascade Lake: Only in increments of 100 GB. - For Intel Ice Lake: Only in increments of 368 GB. For more information see the official documentation. Link: https://cloud.yandex.com/en-ru/docs/managed-clickhouse/concepts/storage Default: "" |
string |
"" |
no |
zookeeper_resource_preset_id | (Optional) The ID of the preset for computational resources available to a ZooKeeper host (CPU, memory etc.). For more information, see the official documentation. Link: https://cloud.yandex.com/en/docs/managed-clickhouse/concepts/instance-types Default: "" |
string |
"" |
no |
Name | Description |
---|---|
cluster_fqdns_list | ClickHouse cluster nodes FQDN list. |
cluster_host_zones_list | ClickHouse cluster host zones. |
cluster_id | ClickHouse cluster ID. |
cluster_name | ClickHouse cluster name. |
cluster_users | A list of users with passwords. |
connection | How connect to ClickHouse cluster? 1. Install certificate mkdir -p /usr/local/share/ca-certificates/Yandex/ && \ wget "https://storage.yandexcloud.net/cloud-certs/CA.pem" -O /usr/local/share/ca-certificates/Yandex/YandexInternalRootCA.crt && \ chmod 0655 /usr/local/share/ca-certificates/Yandex/YandexInternalRootCA.crt 2. Upload config. mkdir --parents ~/.clickhouse-client && \ wget "https://storage.yandexcloud.net/doc-files/clickhouse-client.conf.example" -O ~/.clickhouse-client/config.xml 3. Run connection string from the output value, for example clickhouse-client --host rc1a-xxxxxxxxxxxxxxxx.mdb.yandexcloud.net <br> --secure <br> --user user_name <br> --database database_name <br> --port 9440 <br> --ask-password |
databases | A list of databases names. |
Apache-2.0 Licensed. See LICENSE.