Managing YDB topic configurations
Written by
Updated at October 21, 2024
To work with topicsyandex_ydb_topic
resource.
Note
We recommend creating a topic in a separate folder. A topic in the database root visually breaks the database structure.
yandex_ydb_topic
resource
Description of the yandex_ydb_topic
resource use case:
resource "yandex_ydb_topic" "ydb_topic" {
database_endpoint = yandex_ydb_database_serverless.database1.ydb_full_endpoint # example of connecting to a DB
name = "test_dir/test_topic"
supported_codecs = ["zstd"]
consumer {
name = "test-consumer1"
starting_message_timestamp_ms = 0
supported_codecs = ["zstd","raw"]
}
consumer {
name = "test-consumer2"
starting_message_timestamp_ms = 2000
supported_codecs = ["zstd"]
}
consumer {
name = "test-consumer3"
starting_message_timestamp_ms = 0
supported_codecs = ["zstd"]
}
}
The following fields are supported:
Field name | Type | Description |
---|---|---|
name |
string required |
Topic name |
database_endpoint |
string required |
Full path to the database |
retention_period_ms |
number optional |
Data retention period in milliseconds; the default value is 86400000 (24 hours) |
partitions_count |
number optional |
Number of partitions; the default value is 2 |
supported_codecs |
list(string) optional |
Supported data compression codecs; the default value is gzip, raw, zstd .You can combine them |
consumer |
consumer |
Topic consumers |
Note
You can create, but cannot delete a consumer using Terraform. You can delete a consumer using the management console
Data consumer
Field name | Type | Description |
---|---|---|
name |
string required |
Consumer name |
supported_codecs |
list(string) optional |
Supported data compression codecs; the default value is gzip, raw, zstd . You can combine them |
starting_message_timestamp_ms |
number optional |
Timestamp in UNIX timestamp |