Yandex Cloud
Search
Contact UsGet started
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • AI for business
    • Business tools
  • 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
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
© 2025 Direct Cursus Technology L.L.C.
Terraform in Yandex Cloud
  • Getting started
  • Solution library
    • Overview
    • Release notes
          • ydb_database_dedicated
          • ydb_database_iam_binding
          • ydb_database_serverless
          • ydb_table
          • ydb_table_changefeed
          • ydb_table_index
          • ydb_topic

In this article:

  • Example usage
  • Schema
  • Required
  • Optional
  • Read-Only
  • Nested Schema for column
  • Nested Schema for family
  • Nested Schema for partitioning_settings
  • Nested Schema for partitioning_settings.partition_at_keys
  • Nested Schema for timeouts
  • Nested Schema for ttl
  • Import
  1. Terraform reference
  2. Resources
  3. Managed Service for YDB
  4. Resources
  5. ydb_table

yandex_ydb_table (Resource)

Written by
Yandex Cloud
Updated at September 18, 2025
  • Example usage
  • Schema
    • Required
    • Optional
    • Read-Only
    • Nested Schema for column
    • Nested Schema for family
    • Nested Schema for partitioning_settings
    • Nested Schema for partitioning_settings.partition_at_keys
    • Nested Schema for timeouts
    • Nested Schema for ttl
  • Import

Yandex Database table.

Example usageExample usage

//
// Create a new row-oriented YDB Table.
//
resource "yandex_ydb_table" "test_table" {
  path              = "test_dir/test_table_3_col"
  connection_string = yandex_ydb_database_serverless.database1.ydb_full_endpoint

  column {
    name     = "a"
    type     = "Utf8"
    not_null = true
  }
  column {
    name     = "b"
    type     = "Uint32"
    not_null = true
  }
  column {
    name     = "c"
    type     = "Int32"
    not_null = false
  }
  column {
    name = "d"
    type = "Timestamp"
  }

  primary_key = ["a", "b"]
}
//
// Create a new column-oriented YDB Table.
//
resource "yandex_ydb_table" "test_table" {
  path              = "test_dir/test_table_3_col"
  connection_string = yandex_ydb_database_serverless.database1.ydb_full_endpoint

  column {
    name     = "a"
    type     = "Utf8"
    not_null = true
  }
  column {
    name     = "b"
    type     = "Uint32"
    not_null = true
  }
  column {
    name     = "c"
    type     = "Int32"
    not_null = false
  }
  column {
    name = "d"
    type = "Timestamp"
  }

  primary_key = ["a", "b"]

  store = "column"

  partitioning_settings {
    partition_by = ["b", "a"]
  }
}

SchemaSchema

RequiredRequired

  • column (Block Set, Min: 1) A list of column configuration options. (see below for nested schema)
  • connection_string (String) Connection string for database.
  • path (String) Table path.
  • primary_key (List of String) A list of table columns to be used as primary key.

OptionalOptional

  • attributes (Map of String) A map of table attributes.
  • family (Block List) A list of column group configuration options. The family block may be used to group columns into families to set shared parameters for them. (see below for nested schema)
  • key_bloom_filter (Boolean) Use the Bloom filter for the primary key.
  • partitioning_settings (Block List, Max: 1) Table partitioning settings. (see below for nested schema)
  • read_replicas_settings (String) Read replication settings.
  • store (String) Table storage type. Set to column for column-oriented tables. Omit for row-oriented tables (default).
  • timeouts (Block, Optional) (see below for nested schema)
  • ttl (Block Set, Max: 1) The TTL block supports allow you to create a special column type, TTL column, whose values determine the time-to-live for rows. (see below for nested schema)

Read-OnlyRead-Only

  • id (String) The ID of this resource.

Nested Schema for Nested Schema for column

Required:

  • name (String) Column name.
  • type (String) Column data type. YQL data types are used.

Optional:

  • family (String) Column group.
  • not_null (Boolean) A column cannot have the NULL data type. Default: false.

Nested Schema for Nested Schema for family

Required:

  • compression (String) Data codec (acceptable values: off, lz4).
  • data (String) Type of storage device for column data in this group (acceptable values: ssd, rot (from HDD spindle rotation)).
  • name (String) Column family name.

Nested Schema for Nested Schema for partitioning_settings

Optional:

  • auto_partitioning_by_load (Boolean)
  • auto_partitioning_by_size_enabled (Boolean)
  • auto_partitioning_max_partitions_count (Number)
  • auto_partitioning_min_partitions_count (Number)
  • auto_partitioning_partition_size_mb (Number)
  • partition_at_keys (Block List) (see below for nested schema)
  • partition_by (List of String) Partitioning keys constitute a subset of the table's primary keys. If not set, primary keys will be used.
  • uniform_partitions (Number)

Nested Schema for Nested Schema for partitioning_settings.partition_at_keys

Required:

  • keys (List of String)

Nested Schema for Nested Schema for timeouts

Optional:

  • create (String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
  • default (String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
  • delete (String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
  • read (String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Read operations occur during any refresh or planning operation when refresh is enabled.
  • update (String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).

Nested Schema for Nested Schema for ttl

Required:

  • column_name (String) Column name for TTL.
  • expire_interval (String) Interval in the ISO 8601 format.

Optional:

  • unit (String)

ImportImport

The resource can be imported by using their resource ID. For getting the resource ID you can use Yandex Cloud Web Console or YC CLI.

# terraform import yandex_ydb_table.<resource Name> <resource Id>
terraform import yandex_ydb_table.test_table ...

Was the article helpful?

Previous
ydb_database_serverless
Next
ydb_table_changefeed
© 2025 Direct Cursus Technology L.L.C.