Managing YDB topic configurations
Written by
Updated at January 20, 2025
For operations 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.
Description of the yandex_ydb_topic resource
Usage example for yandex_ydb_topic:
resource "yandex_ydb_topic" "ydb_topic" {
database_endpoint = yandex_ydb_database_serverless.database1.ydb_full_endpoint # DB connection example
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 |
stringrequired |
Topic name |
database_endpoint |
stringrequired |
Full database path |
retention_period_ms |
numberoptional |
Data retention period, in ms. Default value: 86400000 (full day) |
partitions_count |
numberoptional |
Number of partitions; default: 2 |
supported_codecs |
list(string)optional |
Supported data compression codecs; default: "gzip", "raw", "zstd".Can be combined as needed. |
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 |
stringrequired |
Reader name |
supported_codecs |
list(string)optional |
Supported data compression codecs; default: "gzip", "raw", "zstd". Can be combined as needed. |
starting_message_timestamp_ms |
numberoptional |
UNIX timestamp0, i.e., from start of delivery. |