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

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

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

yandex_mdb_redis_cluster (Resource)

Статья создана
Yandex Cloud
Обновлена 11 сентября 2025 г.
  • Example usage
  • Schema
    • Required
    • Optional
    • Read-Only
    • Nested Schema for config
    • Nested Schema for config.backup_window_start
    • Nested Schema for host
    • Nested Schema for resources
    • Nested Schema for access
    • Nested Schema for disk_size_autoscaling
    • Nested Schema for maintenance_window
    • Nested Schema for timeouts
  • Import

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

Example usageExample usage

//
// Create a new MDB Redis Cluster.
//
resource "yandex_mdb_redis_cluster" "my_cluster" {
  name        = "test"
  environment = "PRESTABLE"
  network_id  = yandex_vpc_network.foo.id

  config {
    password = "your_password"
    version  = "6.2"
  }

  resources {
    resource_preset_id = "hm1.nano"
    disk_size          = 16
  }

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

  maintenance_window {
    type = "ANYTIME"
  }
}

resource "yandex_vpc_network" "foo" {}

resource "yandex_vpc_subnet" "foo" {
  zone           = "ru-central1-d"
  network_id     = yandex_vpc_network.foo.id
  v4_cidr_blocks = ["10.5.0.0/24"]
}
//
// Create a new MDB Sharded Redis Cluster.
//
resource "yandex_mdb_redis_cluster" "foo" {
  name        = "test"
  environment = "PRESTABLE"
  network_id  = yandex_vpc_network.foo.id
  sharded     = true

  config {
    version  = "6.2"
    password = "your_password"
  }

  resources {
    resource_preset_id = "hm1.nano"
    disk_size          = 16
  }

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

  host {
    zone       = "ru-central1-b"
    subnet_id  = yandex_vpc_subnet.bar.id
    shard_name = "second"
  }

  host {
    zone       = "ru-central1-d"
    subnet_id  = yandex_vpc_subnet.baz.id
    shard_name = "third"
  }
}

// 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.1.0.0/24"]
}

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

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

SchemaSchema

RequiredRequired

  • config (Block List, Min: 1, Max: 1) Configuration of the Redis cluster. (see below for nested schema)
  • environment (String) Deployment environment of the Redis cluster. Can be either PRESTABLE or PRODUCTION.
  • host (Block List, Min: 1) A host of the Redis 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 Redis cluster. (see below for nested schema)

OptionalOptional

  • access (Block List, Max: 1) Access policy to the Redis cluster. (see below for nested schema)
  • announce_hostnames (Boolean) Announce fqdn instead of ip address.
  • auth_sentinel (Boolean) Allows to use ACL users to auth in sentinel
  • deletion_protection (Boolean) The true value means that resource is protected from accidental deletion.
  • description (String) The resource description.
  • disk_encryption_key_id (String) ID of the KMS key for cluster disk encryption.
  • disk_size_autoscaling (Block List, Max: 1) Disk size autoscaling settings. (see below for nested schema)
  • folder_id (String) The folder identifier that resource belongs to. If it is not provided, the default provider folder-id is used.
  • labels (Map of String) A set of key/value label pairs which assigned to resource.
  • maintenance_window (Block List, Max: 1) Maintenance window settings. (see below for nested schema)
  • persistence_mode (String) Persistence mode. Possible values: ON, OFF.
  • security_group_ids (Set of String) The list of security groups applied to resource or their components.
  • sharded (Boolean) Redis Cluster mode enabled/disabled. Enables sharding when cluster non-sharded. If cluster is sharded - disabling is not allowed.
  • timeouts (Block, Optional) (see below for nested schema)
  • tls_enabled (Boolean) TLS support mode enabled/disabled.

Read-OnlyRead-Only

  • created_at (String) The creation timestamp of the resource.
  • health (String) Aggregated health of the cluster. Can be either ALIVE, DEGRADED, DEAD or HEALTH_UNKNOWN. For more information see health field of JSON representation in the official documentation.
  • id (String) The ID of this resource.
  • status (String) Status of the cluster. Can be either CREATING, STARTING, RUNNING, UPDATING, STOPPING, STOPPED, ERROR or STATUS_UNKNOWN. For more information see status field of JSON representation in the official documentation.

Nested Schema for Nested Schema for config

Required:

  • password (String, Sensitive) Password for the Redis cluster.
  • version (String) Version of Redis.

Optional:

  • allow_data_loss (Boolean) Allows some data to be lost in favor of faster switchover/restart by RDSync.
  • backup_window_start (Block List, Max: 1) Time to start the daily backup, in the UTC timezone. (see below for nested schema)
  • client_output_buffer_limit_normal (String) Normal clients output buffer limits. See redis config file.
  • client_output_buffer_limit_pubsub (String) Pubsub clients output buffer limits. See redis config file.
  • cluster_allow_pubsubshard_when_down (Boolean) Permits Pub/Sub shard operations when cluster is down.
  • cluster_allow_reads_when_down (Boolean) Allows read operations when cluster is down.
  • cluster_require_full_coverage (Boolean) Controls whether all hash slots must be covered by nodes.
  • databases (Number) Number of databases (changing requires redis-server restart).
  • io_threads_allowed (Boolean) Allow Redis to use io-threads.
  • lfu_decay_time (Number) The time, in minutes, that must elapse in order for the key counter to be divided by two (or decremented if it has a value less <= 10).
  • lfu_log_factor (Number) Determines how the frequency counter represents key hits.
  • lua_time_limit (Number) Maximum time in milliseconds for Lua scripts.
  • maxmemory_percent (Number) Redis maxmemory usage in percent
  • maxmemory_policy (String) Redis key eviction policy for a dataset that reaches maximum memory. Can be any of the listed in the official RedisDB documentation.
  • notify_keyspace_events (String) Select the events that Redis will notify among a set of classes.
  • repl_backlog_size_percent (Number) Replication backlog size as a percentage of flavor maxmemory.
  • slowlog_log_slower_than (Number) Log slow queries below this number in microseconds.
  • slowlog_max_len (Number) Slow queries log length.
  • timeout (Number) Close the connection after a client is idle for N seconds.
  • turn_before_switchover (Boolean) Allows to turn before switchover in RDSync.
  • use_luajit (Boolean) Use JIT for lua scripts and functions.
  • zset_max_listpack_entries (Number) Controls max number of entries in zset before conversion from memory-efficient listpack to CPU-efficient hash table and skiplist

Nested Schema for Nested Schema for config.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 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 or not.
  • replica_priority (Number) Replica priority of a current replica (usable for non-sharded only).
  • shard_name (String) The name of the shard to which the host belongs.
  • 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 host, in gigabytes.
  • resource_preset_id (String) The ID of the preset for computational resources available to a host (CPU, memory etc.). For more information, see the official documentation.

Optional:

  • disk_type_id (String) Type of the storage of Redis hosts - environment default is used if missing.

Nested Schema for Nested Schema for access

Optional:

  • data_lens (Boolean) Allow access for DataLens. Can be either true or false.
  • web_sql (Boolean) Allow access for Web SQL. Can be either true or false.

Nested Schema for Nested Schema for disk_size_autoscaling

Required:

  • disk_size_limit (Number) Limit of disk size after autoscaling (GiB).

Optional:

  • emergency_usage_threshold (Number) Immediate autoscaling disk usage (percent).
  • planned_usage_threshold (Number) Maintenance window autoscaling disk usage (percent).

Nested Schema for Nested Schema for maintenance_window

Required:

  • type (String) Type of maintenance window. Can be either ANYTIME or WEEKLY. A day and hour of window need to be specified with weekly window.

Optional:

  • day (String) Day of week for maintenance window if window type is weekly. Possible values: MON, TUE, WED, THU, FRI, SAT, SUN.
  • hour (Number) Hour of day in UTC time zone (1-24) for maintenance window if window type is weekly.

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_redis_cluster.<resource Name> <resource Id>
terraform import yandex_mdb_redis_cluster.my_cluster ...

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

Предыдущая
mdb_redis_user
Следующая
mdb_redis_cluster_v2
Проект Яндекса
© 2025 ООО «Яндекс.Облако»