- Create a Managed Kafka cluster with predefined number of DB hosts
- Create a list of users and topics with permissions
- Create a Connectors
- Easy to use in other resources via outputs
At first you need to create VPC network with three subnets!
Kafka module requires a following input variables:
- VPC network id
- VPC network subnets ids
- Zones and brokers count
Notes:
usersvariable defines a list of separate users with apermissionslist, which indicates to a list of topics and grants for each of them.
See examples section
- Install YC CLI
- Add environment variables for terraform auth in Yandex.Cloud
export YC_TOKEN=$(yc iam create-token)
export YC_CLOUD_ID=$(yc config get cloud-id)
export YC_FOLDER_ID=$(yc config get folder-id)
| Name | Version |
|---|---|
| terraform | >= 1.0.0 |
| yandex | >= 0.127.0 |
| Name | Version |
|---|---|
| random | 3.6.2 |
| yandex | 0.127.0 |
No modules.
| Name | Type |
|---|---|
| random_password.password | resource |
| yandex_mdb_kafka_cluster.this | resource |
| yandex_mdb_kafka_connector.this | resource |
| yandex_mdb_kafka_topic.this | resource |
| yandex_mdb_kafka_user.this | resource |
| yandex_client_config.client | data source |
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| access_policy | Access policy from other services to the MongoDB cluster. | object({ |
{} |
no |
| assign_public_ip | Whether to assign public IP addresses to the instances. | bool |
true |
no |
| brokers_count | The number of brokers. | number |
1 |
no |
| connectors | A list of Kafka connectors to create. | list(object({ |
[] |
no |
| deletion_protection | Inhibits deletion of the cluster. | bool |
false |
no |
| description | Kafka cluster description | string |
"Managed Kafka cluster created by terraform module" |
no |
| disk_size | The size of the disk in GB. | number |
32 |
no |
| disk_type_id | The type of the disk. | string |
"network-ssd" |
no |
| environment | The environment for the Kafka cluster (e.g. PRESTABLE, PRODUCTION). | string |
"PRODUCTION" |
no |
| folder_id | Folder id that contains the MongoDB cluster | string |
null |
no |
| kafka_config | The configuration for the Kafka broker. | object({ |
{} |
no |
| kafka_version | The Kafka version to use. | string |
"3.5" |
no |
| labels | A set of label pairs to assing to the Kafka cluster. | map(any) |
{} |
no |
| maintenance_window | (Optional) Maintenance policy of the MongoDB 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. |
object({ |
{ |
no |
| name | The name of the Kafka cluster. | string |
"kafka-cluster" |
no |
| network_id | The ID of the VPC network where the cluster will be deployed. | string |
n/a | yes |
| resource_preset_id | The resource preset ID. | string |
"s3-c2-m8" |
no |
| schema_registry | Whether to enable the schema registry. | bool |
false |
no |
| security_groups_ids_list | A list of security group IDs to which the MongoDB cluster belongs | list(string) |
[] |
no |
| subnet_ids | A list of subnet IDs to deploy the cluster in. | list(string) |
n/a | yes |
| topics | A list of Kafka topics to create. | list(object({ |
[] |
no |
| users | A list of Kafka users to create. | list(object({ |
[] |
no |
| zones | A list of availability zones. | list(string) |
n/a | yes |
| zookeeper_config | The configuration for ZooKeeper nodes. | object({ |
{ |
no |
| Name | Description |
|---|---|
| cluster_host_names_list | Kafka cluster host name |
| cluster_id | Kafka cluster ID |
| cluster_name | Kafka cluster name |
| connection_step_1 | 1 step - Install certificate |
| connection_step_2 | How connect to Kafka cluster? 1. Run connection string from the output value, for example kafkacat -C <br> -b <FQDN_брокера>:9091 <br> -t <имя_топика> <br> -X security.protocol=SASL_SSL <br> -X sasl.mechanism=SCRAM-SHA-512 <br> -X sasl.username="<логин_потребителя>" <br> -X sasl.password="<пароль_потребителя>" <br> -X ssl.ca.location=/usr/local/share/ca-certificates/Yandex/YandexInternalRootCA.crt -Z -K: |
| topics | A list of topics names. |
| users_data | A list of users with passwords. |