yandex_ydb_database_dedicated (Resource)
Статья создана
Обновлена 11 сентября 2025 г.
- Example usage
- Schema
- Required
- Optional
- Read-Only
- Nested Schema for scale_policy
- Nested Schema for scale_policy.auto_scale
- Nested Schema for scale_policy.auto_scale.target_tracking
- Nested Schema for scale_policy.fixed_scale
- Nested Schema for storage_config
- Nested Schema for location
- Nested Schema for location.region
- Nested Schema for timeouts
- Import
Yandex Database (dedicated) resource. For more information, see the official documentation.
Example usage
//
// Create a new YDB Dedicated Database.
//
resource "yandex_ydb_database_dedicated" "database1" {
name = "test-ydb-dedicated"
folder_id = data.yandex_resourcemanager_folder.test_folder.id
network_id = yandex_vpc_network.my-inst-group-network.id
subnet_ids = ["${yandex_vpc_subnet.my-inst-group-subnet.id}"]
resource_preset_id = "medium"
deletion_protection = true
scale_policy {
fixed_scale {
size = 1
}
}
storage_config {
group_count = 1
storage_type_id = "ssd"
}
location {
region {
id = "ru-central1"
}
}
}
//
// Create a new YDB Dedicated Database with auto-scale policy.
//
resource "yandex_ydb_database_dedicated" "database1" {
name = "test-ydb-dedicated"
folder_id = data.yandex_resourcemanager_folder.test_folder.id
network_id = yandex_vpc_network.my-inst-group-network.id
subnet_ids = ["${yandex_vpc_subnet.my-inst-group-subnet.id}"]
resource_preset_id = "medium"
deletion_protection = true
scale_policy {
auto_scale {
min_size = 2
max_size = 8
target_tracking {
cpu_utilization_percent = 70
}
}
}
labels = {
# enable preview feature
enable_autoscaling = "1"
}
storage_config {
group_count = 1
storage_type_id = "ssd"
}
location {
region {
id = "ru-central1"
}
}
}
Schema
Required
name
(String) The resource name.network_id
(String) TheVPC Network ID
of subnets which resource attached to.resource_preset_id
(String) The Yandex Database cluster preset. Available presets can be obtained viayc ydb resource-preset list
command.scale_policy
(Block List, Min: 1, Max: 1) Scaling policy for the Yandex Database cluster. (see below for nested schema)storage_config
(Block List, Min: 1, Max: 1) A list of storage configuration options for the Yandex Database cluster. (see below for nested schema)subnet_ids
(Set of String) The list of VPC subnets identifiers which resource is attached.
Optional
assign_public_ips
(Boolean) Whether public IP addresses should be assigned to the Yandex Database cluster.deletion_protection
(Boolean) Thetrue
value means that resource is protected from accidental deletion.description
(String) The resource description.folder_id
(String) The folder identifier that resource belongs to. If it is not provided, the default providerfolder-id
is used.labels
(Map of String) A set of key/value label pairs which assigned to resource.location
(Block List, Max: 1) Location for the Yandex Database cluster. (see below for nested schema)location_id
(String) Location ID for the Yandex Database cluster.security_group_ids
(Set of String) The list of security groups applied to resource or their components.sleep_after
(Number)timeouts
(Block, Optional) (see below for nested schema)
Read-Only
created_at
(String) The creation timestamp of the resource.database_path
(String) Full database path of the Yandex Database cluster. Useful for SDK configuration.id
(String) The ID of this resource.status
(String) Status of the Yandex Database cluster.tls_enabled
(Boolean) Whether TLS is enabled for the Yandex Database cluster. Useful for SDK configuration.ydb_api_endpoint
(String) API endpoint of the Yandex Database cluster. Useful for SDK configuration.ydb_full_endpoint
(String) Full endpoint of the Yandex Database cluster.
scale_policy
Nested Schema for Optional:
auto_scale
(Block List, Max: 1) Auto scaling policy for the Yandex Database cluster. This is a preview feature, and you need to enable it using the labelenable_autoscaling=1
. (see below for nested schema)fixed_scale
(Block List, Max: 1) Fixed scaling policy for the Yandex Database cluster. (see below for nested schema)
scale_policy.auto_scale
Nested Schema for Required:
max_size
(Number) Maximum number of nodes to which autoscaling can scale the database.min_size
(Number) Minimum number of nodes to which autoscaling can scale the database.target_tracking
(Block List, Min: 1, Max: 1) A target tracking scaling policy automatically scales the capacity of your Yandex Database cluster based on a target metric value. (see below for nested schema)
scale_policy.auto_scale.target_tracking
Nested Schema for Required:
cpu_utilization_percent
(Number) A percentage of database nodes average CPU utilization.
scale_policy.fixed_scale
Nested Schema for Required:
size
(Number) Number of instances for the Yandex Database cluster.
storage_config
Nested Schema for Required:
group_count
(Number) Amount of storage groups of selected type for the Yandex Database cluster.storage_type_id
(String) Storage type ID for the Yandex Database cluster. Available presets can be obtained viayc ydb storage-type list
command.
location
Nested Schema for Optional:
region
(Block List, Max: 1) Region for the Yandex Database cluster. (see below for nested schema)
location.region
Nested Schema for Required:
id
(String) Region ID for the Yandex Database cluster.
timeouts
Nested Schema for Optional:
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).
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_database_dedicated.<resource Name> <resource Id>
terraform import yandex_ydb_database_dedicated.my_ydb ...