Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
  • Blog
  • Pricing
  • Documentation
Yandex project
© 2025 Yandex.Cloud LLC
Yandex Managed Service for YDB
  • Getting started
  • Access management
  • Monitoring metrics
  • Audit Trails events
    • Introduction to YDB via Terraform
    • Getting authentication credentials
    • Installing and configuring Terraform and a provider to connect to YDB
    • Creating configuration files and connecting to YDB
    • Creating and editing parameters of a serverless database
    • Creating and editing parameters of a dedicated database
    • Creating row tables in a database
    • Creating document tables in a database
    • Creating a changefeed for a table
    • Creating secondary indexes in row tables
    • Managing YDB topic configurations
  • FAQ
  • Public materials
  1. Working with YDB via Terraform
  2. Managing YDB topic configurations

Managing YDB topic configurations

Written by
Yandex Cloud
Updated at January 20, 2025

For operations with topics, use the yandex_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 resourceDescription 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 string
required
Topic name
database_endpoint string
required
Full database path
retention_period_ms number
optional
Data retention period, in ms. Default value: 86400000 (full day)
partitions_count number
optional
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 or YDB CLI.

Data consumer description:

Field name Type Description
name string
required
Reader name
supported_codecs list(string)
optional
Supported data compression codecs; default: "gzip", "raw", "zstd". Can be combined as needed.
starting_message_timestamp_ms number
optional
UNIX timestamp, in ms, the consumer will start reading data from. The default is 0, i.e., from start of delivery.

Was the article helpful?

Previous
Creating secondary indexes in row tables
Next
FAQ
Yandex project
© 2025 Yandex.Cloud LLC