Yandex Cloud
Search
Contact UsTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Yandex Managed Service for YDB
  • Getting started
  • Access management
  • Monitoring metrics
  • Audit Trails events
    • Introduction to using 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 reconfiguring a serverless database
    • Creating and reconfiguring a dedicated database
    • Creating row-oriented and column-oriented tables in a database
    • Creating document tables in a database
    • Creating a change data feed for a table
    • Creating secondary indexes in row-oriented tables
    • Managing YDB topic configurations
  • FAQ
  • Public materials

In this article:

  • Resources
  • Data sources
  1. Using YDB via Terraform
  2. Introduction to using YDB via Terraform

Introduction to using YDB via Terraform

Written by
Yandex Cloud
Updated at April 24, 2026
  • Resources
  • Data sources

Terraform is an open-source software solution developed by HashiCorp for managing a cloud infrastructure based on the Infrastructure as Code paradigm. This means that you describe the target infrastructure state 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 extension. The HCL code is very similar to JSON and arranged into logical sections within configuration files.

With Terraform, you can create and update YDB databases, as well as manage their resources, such as tables, indexes, and table change data feeds. You should keep in mind that the configuration file you create to manage YDB becomes the single point of control for the database state, and you should describe any database updates in it. This is because after you successfully apply changes, Terraform creates a special state file, i.e., a text representation of the current database state, and uses it for reference in all subsequent updates.

If you update 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 the code in the state file. However, this does not mean that Terraform will automatically accept new changes and update the state file. The next time you run the terraform apply command, Terraform will try to bring the resources back to the state described in your configuration file, which can overwrite or delete your changes made outside Terraform. Therefore, to avoid conflicts between YDB state updates, you should use the configuration file as the single point of access.

Terraform connects to YDB via the yandex_ydb provider, with authentication via the yc console client.

This section contains the following guides:

  1. Getting authentication credentials.
  2. Installing and configuring Terraform and a provider to connect to YDB.
  3. Creating configuration files and connecting to YDB.
  4. Creating and reconfiguring a serverless database.
  5. Creating and reconfiguring a dedicated database.
  6. Creating row-oriented and column-oriented tables in a database.
  7. Creating a change data feed for a table.
  8. Creating secondary indexes in row-oriented tables.
  9. Creating topics.

ResourcesResources

Managed Service for YDB supports the following Terraform provider resources:

Terraform resource Yandex Cloud resource
yandex_ydb_database_dedicated Database on dedicated resources
yandex_ydb_database_iam_binding Binding access permissions 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
© 2026 Direct Cursus Technology L.L.C.