Yandex Cloud
Поиск
Связаться с намиПодключиться
  • Истории успеха
  • Документация
  • Блог
  • Все сервисы
  • Статус работы сервисов
    • Доступны в регионе
    • Инфраструктура и сеть
    • Платформа данных
    • Контейнеры
    • Инструменты разработчика
    • Бессерверные вычисления
    • Безопасность
    • Мониторинг и управление ресурсами
    • ИИ для бизнеса
    • Бизнес-инструменты
  • Все решения
    • По отраслям
    • По типу задач
    • Экономика платформы
    • Безопасность
    • Техническая поддержка
    • Каталог партнёров
    • Обучение и сертификация
    • Облако для стартапов
    • Облако для крупного бизнеса
    • Центр технологий для общества
    • Партнёрская программа
    • Поддержка IT-бизнеса
    • Облако для фрилансеров
    • Обучение и сертификация
    • Блог
    • Документация
    • Мероприятия и вебинары
    • Контакты, чаты и сообщества
    • Идеи
    • Тарифы Yandex Cloud
    • Промоакции и free tier
    • Правила тарификации
  • Истории успеха
  • Документация
  • Блог
Проект Яндекса
© 2025 ТОО «Облачные Сервисы Казахстан»
Terraform в Yandex Cloud
  • Начало работы
  • Библиотека решений
    • Обзор
    • История изменений (англ.)
          • mdb_sqlserver_cluster

В этой статье:

  • Example usage
  • Schema
  • Required
  • Optional
  • Read-Only
  • Nested Schema for database
  • Nested Schema for host
  • Nested Schema for resources
  • Nested Schema for user
  • Nested Schema for user.permission
  • Nested Schema for backup_window_start
  • Nested Schema for timeouts
  • Import
  1. Справочник Terraform
  2. Ресурсы (англ.)
  3. Managed Service for SQLServer
  4. Resources
  5. mdb_sqlserver_cluster

yandex_mdb_sqlserver_cluster (Resource)

Статья создана
Yandex Cloud
Обновлена 7 августа 2025 г.
  • Example usage
  • Schema
    • Required
    • Optional
    • Read-Only
    • Nested Schema for database
    • Nested Schema for host
    • Nested Schema for resources
    • Nested Schema for user
    • Nested Schema for user.permission
    • Nested Schema for backup_window_start
    • Nested Schema for timeouts
  • Import

Manages a SQLServer cluster within the Yandex Cloud. For more information, see the official documentation.

Please read Pricing for Managed Service for SQL Server before using SQLServer cluster.

Example usageExample usage

//
// Create a new MDB SQL Server Cluster.
//
resource "yandex_mdb_sqlserver_cluster" "my_cluster" {
  name        = "test"
  environment = "PRESTABLE"
  network_id  = yandex_vpc_network.foo.id
  version     = "2016sp2std"

  resources {
    resource_preset_id = "s2.small"
    disk_type_id       = "network-ssd"
    disk_size          = 20
  }

  labels = { test_key : "test_value" }

  backup_window_start {
    hours   = 20
    minutes = 30
  }

  sqlserver_config = {
    fill_factor_percent           = 49
    optimize_for_ad_hoc_workloads = true
  }

  database {
    name = "db_name_a"
  }
  database {
    name = "db_name"
  }
  database {
    name = "db_name_b"
  }

  user {
    name     = "bob"
    password = "mysecurepassword"
  }

  user {
    name     = "alice"
    password = "mysecurepassword"

    permission {
      database_name = "db_name"
      roles         = ["DDLADMIN"]
    }
  }

  user {
    name     = "chuck"
    password = "mysecurepassword"

    permission {
      database_name = "db_name_a"
      roles         = ["OWNER"]
    }
    permission {
      database_name = "db_name"
      roles         = ["OWNER", "DDLADMIN"]
    }
    permission {
      database_name = "db_name_b"
      roles         = ["OWNER", "DDLADMIN"]
    }
  }

  host {
    zone      = "ru-central1-a"
    subnet_id = yandex_vpc_subnet.foo.id
  }

  security_group_ids = [yandex_vpc_security_group.test-sg-x.id]
  host_group_ids     = ["host_group_1", "host_group_2"]
}

// Auxiliary resources
resource "yandex_vpc_network" "foo" {}

resource "yandex_vpc_subnet" "foo" {
  zone           = "ru-central1-a"
  network_id     = yandex_vpc_network.foo.id
  v4_cidr_blocks = ["10.5.0.0/24"]
}

resource "yandex_vpc_security_group" "test-sg-x" {
  network_id = yandex_vpc_network.foo.id
  ingress {
    protocol       = "ANY"
    description    = "Allow incoming traffic from members of the same security group"
    from_port      = 0
    to_port        = 65535
    v4_cidr_blocks = ["0.0.0.0/0"]
  }
  egress {
    protocol       = "ANY"
    description    = "Allow outgoing traffic to members of the same security group"
    from_port      = 0
    to_port        = 65535
    v4_cidr_blocks = ["0.0.0.0/0"]
  }
}

SchemaSchema

RequiredRequired

  • database (Block List, Min: 1) A database of the SQLServer cluster. (see below for nested schema)
  • environment (String) Deployment environment of the SQLServer cluster. (PRODUCTION, PRESTABLE).
  • host (Block List, Min: 1) A host of the SQLServer cluster. (see below for nested schema)
  • name (String) The resource name.
  • network_id (String) The VPC Network ID of subnets which resource attached to.
  • resources (Block List, Min: 1, Max: 1) Resources allocated to hosts of the SQLServer cluster. (see below for nested schema)
  • user (Block List, Min: 1) A user of the SQLServer cluster. (see below for nested schema)
  • version (String) Version of the SQLServer cluster. (2016sp2std, 2016sp2ent).

OptionalOptional

  • backup_window_start (Block List, Max: 1) Time to start the daily backup, in the UTC. (see below for nested schema)
  • deletion_protection (Boolean) The true 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 provider folder-id is used.
  • host_group_ids (Set of String) A list of IDs of the host groups hosting VMs of the cluster.
  • labels (Map of String) A set of key/value label pairs which assigned to resource.
  • security_group_ids (Set of String) The list of security groups applied to resource or their components.
  • sqlcollation (String) SQL Collation cluster will be created with. This attribute cannot be changed when cluster is created!
  • sqlserver_config (Map of String) SQLServer cluster config. Detail info in SQLServer config section.
  • timeouts (Block, Optional) (see below for nested schema)

Read-OnlyRead-Only

  • created_at (String) The creation timestamp of the resource.
  • health (String) Aggregated health of the cluster.
  • id (String) The ID of this resource.
  • status (String) Status of the cluster.

Nested Schema for Nested Schema for database

Required:

  • name (String) The name of the database.

Nested Schema for Nested Schema for host

Required:

  • zone (String) The availability zone where resource is located. If it is not provided, the default provider zone will be used.

Optional:

  • assign_public_ip (Boolean) Sets whether the host should get a public IP address on creation. Changing this parameter for an existing host is not supported at the moment.
  • subnet_id (String) The ID of the subnet, to which the host belongs. The subnet must be a part of the network to which the cluster belongs.

Read-Only:

  • fqdn (String) The fully qualified domain name of the host.

Nested Schema for Nested Schema for resources

Required:

  • disk_size (Number) Volume of the storage available to a SQLServer host, in gigabytes.
  • disk_type_id (String) Type of the storage of SQLServer hosts.
  • resource_preset_id (String) The ID of the preset for computational resources available to a SQLServer host (CPU, memory etc.). For more information, see the official documentation.

Nested Schema for Nested Schema for user

Required:

  • name (String) The name of the user.
  • password (String, Sensitive) The password of the user.

Optional:

  • permission (Block Set) Set of permissions granted to the user. (see below for nested schema)

Nested Schema for Nested Schema for user.permission

Required:

  • database_name (String) The name of the database that the permission grants access to.

Optional:

  • roles (Set of String) List user's roles in the database. Allowed roles: OWNER, SECURITYADMIN, ACCESSADMIN, BACKUPOPERATOR, DDLADMIN, DATAWRITER, DATAREADER, DENYDATAWRITER, DENYDATAREADER.

Nested Schema for Nested Schema for backup_window_start

Optional:

  • hours (Number) The hour at which backup will be started.
  • minutes (Number) The minute at which backup will be started.

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).
  • 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.
  • 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).

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_mdb_sqlserver_cluster.<resource Name> <resource Id>
terraform import yandex_mdb_sqlserver_cluster.my_cluster ...

Была ли статья полезна?

Предыдущая
mdb_sqlserver_cluster
Следующая
mdb_sharded_postgresql_cluster
Проект Яндекса
© 2025 ТОО «Облачные Сервисы Казахстан»