yandex_ydb_table (Resource)
Статья создана
Обновлена 18 сентября 2025 г.
Yandex Database table.
Example 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"]
}
}
Schema
Required
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.
Optional
attributes
(Map of String) A map of table attributes.family
(Block List) A list of column group configuration options. Thefamily
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 tocolumn
for column-oriented tables. Omit for row-oriented tables (default).timeouts
(Block, Optional) (see below for nested schema)ttl
(Block Set, Max: 1) TheTTL
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-Only
id
(String) The ID of this resource.
column
Nested Schema for 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
.
family
Nested Schema for 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.
partitioning_settings
Nested Schema for 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)
partitioning_settings.partition_at_keys
Nested Schema for Required:
keys
(List of String)
timeouts
Nested Schema for 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).
ttl
Nested Schema for Required:
column_name
(String) Column name for TTL.expire_interval
(String) Interval in the ISO 8601 format.
Optional:
unit
(String)
Import
The resource can be imported by using their resource ID
. For getting the resource ID you can use Yandex Cloud Web Console
# terraform import yandex_ydb_table.<resource Name> <resource Id>
terraform import yandex_ydb_table.test_table ...