[Yandex Cloud documentation](../../index.md) > [Yandex Managed Service for YDB](../index.md) > Using YDB via Terraform > Introduction to using YDB via Terraform

# Introduction to using YDB via Terraform

[Terraform](https://www.terraform.io) 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](https://developer.hashicorp.com/terraform/language/syntax) (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](../../cli/quickstart.md) console client.

This section contains the following guides:
1. [Getting authentication credentials](credentials.md).
1. [Installing and configuring Terraform and a provider to connect to YDB](install.md).
1. [Creating configuration files and connecting to YDB](configure.md).
1. [Creating and reconfiguring a serverless database](serverless-database.md).
1. [Creating and reconfiguring a dedicated database](dedicated-database.md).
1. [Creating row-oriented and column-oriented tables in a database](tables.md).
1. [Creating a change data feed for a table](cdc.md).
1. [Creating secondary indexes in row-oriented tables](tables-secondary-index.md).
1. [Creating topics](topic.md).

## Resources {#resources}

Managed Service for YDB supports the following Terraform provider resources:

| **Terraform resource** | **Yandex Cloud resource** |
| --- | --- |
| [yandex_ydb_database_dedicated](../../terraform/resources/ydb_database_dedicated.md) | Database [on dedicated resources](../concepts/resources.md#resource-presets) |
| [yandex_ydb_database_iam_binding](../../terraform/resources/ydb_database_iam_binding.md) | [Binding](../../iam/concepts/access-control/index.md#access-bindings) access permissions to a database |
| [yandex_ydb_database_serverless](../../terraform/resources/ydb_database_serverless.md) | [Serverless](../concepts/resources.md#serverless) database |
| [yandex_ydb_topic](../../terraform/resources/ydb_topic.md) | [Topic](https://ydb.tech/docs/en//concepts/topic) |
| [yandex_ydb_table](../../terraform/resources/ydb_table.md) | [Table](https://ydb.tech/docs/en//concepts/datamodel/table) |
| [yandex_ydb_table_changefeed](../../terraform/resources/ydb_table_changefeed.md) | [Change Data Capture](https://ydb.tech/docs/en//concepts/cdc) |
| `yandex_ydb_table_index` | [Table secondary index](https://ydb.tech/docs/en//concepts/secondary_indexes) |

## Data sources {#data-sources}

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

| **Terraform data source** | **Description** |
| --- | --- |
| [yandex_ydb_database_dedicated](../../terraform/data-sources/ydb_database_dedicated.md) | Information about a database [on dedicated resources](../concepts/resources.md#resource-presets) |
| [yandex_ydb_database_serverless](../../terraform/data-sources/ydb_database_serverless.md) | Information about a [serverless](../concepts/resources.md#serverless) database |