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
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
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

In this article:

  • Resources
  • Data sources
  1. Working with YDB via Terraform
  2. Introduction to YDB via Terraform

Introduction to YDB via Terraform

Written by
Yandex Cloud
Updated at November 26, 2024
  • Resources
  • Data sources

Terraform is an open-source software solution developed by HashiCorp for managing cloud infrastructure based on the Infrastructure as Code paradigm. This means that the target state of the infrastructure is described in configuration files, and Terraform applies these changes to the infrastructure using auxiliary programs (providers). Configuration files use a special language, HCL (HashiCorp Configuration Language), and have the tf extention. The HCL code is very similar to JSON and organized into logical sections within configuration files.

With Terraform, you can create and modify YDB databases, as well as manage their resources, such as tables, indexes, and table changefeeds. It is important to understand that the configuration file you create to manage YDB becomes the single point of control for the database state, and all your database updates must take place through it. This is because after each successful update, Terraform creates a special state file, i.e., a textual representation of the current database state, and uses it for reference in all subsequent updates.

If you modify the database state via the configuration file and then change something else using the management console or CLI, Terraform will remain unaware of these changes until you run the terraform plan or terraform refresh commands. These commands will force Terraform to check the current state of the resources against what is written in the state file. However, this does not mean that Terraform will automatically accept new changes and update the state file. The reason is that the next time you run the terraform apply command, Terraform will try to bring the resources to the state described in your configuration file, which can overwrite or delete your external changes. Therefore, to avoid conflicts between YDB state updates, you should use the single point of access, i.e., the configuration file.

Terraform connects to YDB via the yandex_ydb provider, and authentication is enabled by the yc console client.

This section contains the following guides:

  1. Obtaining authentication data.
  2. Installing and configuring Terraform and a provider to connect to YDB.
  3. Creating configuration files and connecting to YDB.
  4. Creating and editing parameters of a serverless database.
  5. Creating and editing parameters of a dedicated database.
  6. Creating row-oriented tables in a database.
  7. Creating a table changefeed.
  8. Creating secondary indexes in row-oriented tables.
  9. Creating topics.

ResourcesResources

The following Terraform provider resources are supported for Managed Service for YDB:

Terraform resource Yandex Cloud resource
yandex_ydb_database_dedicated Database on dedicated resources
yandex_ydb_database_iam_binding Binding access privileges to a database
yandex_ydb_database_serverless Serverless database
yandex_ydb_topic Topic
yandex_ydb_table Table
yandex_ydb_table_changefeed Change Data Capture
yandex_ydb_table_index Table secondary index

Data sourcesData sources

Managed Service for YDB supports the following Terraform provider data sources:

Terraform data source Description
yandex_ydb_database_dedicated Information about a database on dedicated resources
yandex_ydb_database_serverless Information about a serverless database

Was the article helpful?

Previous
Audit Trails events
Next
Getting authentication credentials
© 2025 Direct Cursus Technology L.L.C.