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

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

  • Example usage
  • Schema
  • Required
  • Optional
  • Read-Only
  • Nested Schema for cluster_config
  • Nested Schema for cluster_config.access
  • Nested Schema for cluster_config.backup_window_start
  • Nested Schema for cluster_config.mongocfg
  • Nested Schema for cluster_config.mongocfg.audit_log
  • Nested Schema for cluster_config.mongocfg.net
  • Nested Schema for cluster_config.mongocfg.operation_profiling
  • Nested Schema for cluster_config.mongocfg.oplog
  • Nested Schema for cluster_config.mongocfg.set_parameter
  • Nested Schema for cluster_config.mongocfg.storage
  • Nested Schema for cluster_config.mongocfg.storage.wired_tiger
  • Nested Schema for cluster_config.mongod
  • Nested Schema for cluster_config.mongod.audit_log
  • Nested Schema for cluster_config.mongod.net
  • Nested Schema for cluster_config.mongod.operation_profiling
  • Nested Schema for cluster_config.mongod.oplog
  • Nested Schema for cluster_config.mongod.security
  • Nested Schema for cluster_config.mongod.security.kmip
  • Nested Schema for cluster_config.mongod.set_parameter
  • Nested Schema for cluster_config.mongod.set_parameter.mirror_reads
  • Nested Schema for cluster_config.mongod.storage
  • Nested Schema for cluster_config.mongod.storage.journal
  • Nested Schema for cluster_config.mongod.storage.wired_tiger
  • Nested Schema for cluster_config.mongos
  • Nested Schema for cluster_config.mongos.audit_log
  • Nested Schema for cluster_config.mongos.net
  • Nested Schema for cluster_config.mongos.set_parameter
  • Nested Schema for cluster_config.performance_diagnostics
  • Nested Schema for host
  • Nested Schema for host.host_parameters
  • Nested Schema for database
  • Nested Schema for disk_size_autoscaling_mongocfg
  • Nested Schema for disk_size_autoscaling_mongod
  • Nested Schema for disk_size_autoscaling_mongoinfra
  • Nested Schema for disk_size_autoscaling_mongos
  • Nested Schema for maintenance_window
  • Nested Schema for resources
  • Nested Schema for resources_mongocfg
  • Nested Schema for resources_mongod
  • Nested Schema for resources_mongoinfra
  • Nested Schema for resources_mongos
  • Nested Schema for restore
  • Nested Schema for timeouts
  • Nested Schema for user
  • Nested Schema for user.permission
  • Import
  1. Справочник Terraform
  2. Ресурсы (англ.)
  3. Managed Service for MongoDB
  4. Resources
  5. mdb_mongodb_cluster

yandex_mdb_mongodb_cluster (Resource)

Статья создана
Yandex Cloud
Обновлена 12 декабря 2025 г.
  • Example usage
  • Schema
    • Required
    • Optional
    • Read-Only
    • Nested Schema for cluster_config
    • Nested Schema for cluster_config.access
    • Nested Schema for cluster_config.backup_window_start
    • Nested Schema for cluster_config.mongocfg
    • Nested Schema for cluster_config.mongocfg.audit_log
    • Nested Schema for cluster_config.mongocfg.net
    • Nested Schema for cluster_config.mongocfg.operation_profiling
    • Nested Schema for cluster_config.mongocfg.oplog
    • Nested Schema for cluster_config.mongocfg.set_parameter
    • Nested Schema for cluster_config.mongocfg.storage
    • Nested Schema for cluster_config.mongocfg.storage.wired_tiger
    • Nested Schema for cluster_config.mongod
    • Nested Schema for cluster_config.mongod.audit_log
    • Nested Schema for cluster_config.mongod.net
    • Nested Schema for cluster_config.mongod.operation_profiling
    • Nested Schema for cluster_config.mongod.oplog
    • Nested Schema for cluster_config.mongod.security
    • Nested Schema for cluster_config.mongod.security.kmip
    • Nested Schema for cluster_config.mongod.set_parameter
    • Nested Schema for cluster_config.mongod.set_parameter.mirror_reads
    • Nested Schema for cluster_config.mongod.storage
    • Nested Schema for cluster_config.mongod.storage.journal
    • Nested Schema for cluster_config.mongod.storage.wired_tiger
    • Nested Schema for cluster_config.mongos
    • Nested Schema for cluster_config.mongos.audit_log
    • Nested Schema for cluster_config.mongos.net
    • Nested Schema for cluster_config.mongos.set_parameter
    • Nested Schema for cluster_config.performance_diagnostics
    • Nested Schema for host
    • Nested Schema for host.host_parameters
    • Nested Schema for database
    • Nested Schema for disk_size_autoscaling_mongocfg
    • Nested Schema for disk_size_autoscaling_mongod
    • Nested Schema for disk_size_autoscaling_mongoinfra
    • Nested Schema for disk_size_autoscaling_mongos
    • Nested Schema for maintenance_window
    • Nested Schema for resources
    • Nested Schema for resources_mongocfg
    • Nested Schema for resources_mongod
    • Nested Schema for resources_mongoinfra
    • Nested Schema for resources_mongos
    • Nested Schema for restore
    • Nested Schema for timeouts
    • Nested Schema for user
    • Nested Schema for user.permission
  • Import

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

Example usageExample usage

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

  cluster_config {
    version = "4.2"
  }

  labels = {
    test_key = "test_value"
  }

  database {
    name = "testdb"
  }

  user {
    name     = "john"
    password = "password"
    permission {
      database_name = "testdb"
    }
  }

  resources_mongod {
    resource_preset_id = "s2.small"
    disk_size          = 16
    disk_type_id       = "network-hdd"
  }

  resources_mongos {
    resource_preset_id = "s2.small"
    disk_size          = 14
    disk_type_id       = "network-hdd"
  }

  resources_mongocfg {
    resource_preset_id = "s2.small"
    disk_size          = 14
    disk_type_id       = "network-hdd"
  }

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

  maintenance_window {
    type = "ANYTIME"
  }
}

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

SchemaSchema

RequiredRequired

  • cluster_config (Block List, Min: 1, Max: 1) Configuration of the MongoDB subcluster. (see below for nested schema)
  • environment (String) Deployment environment of the MongoDB cluster. Can be either PRESTABLE or PRODUCTION.
  • host (Block List, Min: 1) A host of the MongoDB cluster. (see below for nested schema)
  • name (String) The resource name.
  • network_id (String) The VPC Network ID of subnets which resource attached to.

OptionalOptional

  • cluster_id (String) The ID of the cluster.
  • database (Block Set, Deprecated) A database of the MongoDB cluster. (see below for nested schema)
  • 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_mongocfg (Block List, Max: 1) Disk size autoscaling settings for mongocfg. (see below for nested schema)
  • disk_size_autoscaling_mongod (Block List, Max: 1) Disk size autoscaling settings for mongod. (see below for nested schema)
  • disk_size_autoscaling_mongoinfra (Block List, Max: 1) Disk size autoscaling settings for mongoinfra. (see below for nested schema)
  • disk_size_autoscaling_mongos (Block List, Max: 1) Disk size autoscaling settings for mongos. (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 of the MongoDB cluster. (see below for nested schema)
  • resources (Block List, Max: 1, Deprecated) (DEPRECATED, use resources_* instead) Resources allocated to hosts of the MongoDB cluster. (see below for nested schema)
  • resources_mongocfg (Block List, Max: 1) Resources allocated to mongocfg hosts of the MongoDB cluster. (see below for nested schema)
  • resources_mongod (Block List, Max: 1) Resources allocated to mongod hosts of the MongoDB cluster. (see below for nested schema)
  • resources_mongoinfra (Block List, Max: 1) Resources allocated to mongoinfra hosts of the MongoDB cluster. (see below for nested schema)
  • resources_mongos (Block List, Max: 1) Resources allocated to mongos hosts of the MongoDB cluster. (see below for nested schema)
  • restore (Block List, Max: 1) The cluster will be created from the specified backup. (see below for nested schema)
  • security_group_ids (Set of String) The list of security groups applied to resource or their components.
  • timeouts (Block, Optional) (see below for nested schema)
  • user (Block Set, Deprecated) A user of the MongoDB cluster. (see below for nested schema)

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.
  • sharded (Boolean) MongoDB Cluster mode enabled/disabled.
  • 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 cluster_config

Required:

  • version (String) Version of the MongoDB server software. Can be either 4.2, 4.4, 4.4-enterprise, 5.0, 5.0-enterprise, 6.0 and 6.0-enterprise.

Optional:

  • access (Block List, Max: 1) Access policy to the MongoDB cluster. (see below for nested schema)
  • backup_retain_period_days (Number) Retain period of automatically created backup in days.
  • backup_window_start (Block List, Max: 1) Time to start the daily backup, in the UTC timezone. (see below for nested schema)
  • feature_compatibility_version (String) Feature compatibility version of MongoDB. If not provided version is taken. Can be either 6.0, 5.0, 4.4 and 4.2.
  • mongocfg (Block List, Max: 1) Configuration of the mongocfg service. (see below for nested schema)
  • mongod (Block List, Max: 1) Configuration of the mongod service. (see below for nested schema)
  • mongos (Block List, Max: 1) Configuration of the mongos service. (see below for nested schema)
  • performance_diagnostics (Block List, Max: 1) Performance diagnostics to the MongoDB cluster. (see below for nested schema)

Nested Schema for Nested Schema for cluster_config.access

Optional:

  • data_lens (Boolean) Allow access for Yandex DataLens.
  • data_transfer (Boolean) Allow access for DataTransfer.
  • web_sql (Boolean) Allow access for WebSQL.

Nested Schema for Nested Schema for cluster_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 cluster_config.mongocfg

Optional:

  • audit_log (Block List, Max: 1) A set of audit log settings (see the auditLog option). Available only in enterprise edition. (see below for nested schema)
  • chaining_allowed (Boolean) Chained replication setting. For more information, see the chainingAllowed description in the official documentation.
  • net (Block List, Max: 1) A set of network settings (see the net option). (see below for nested schema)
  • operation_profiling (Block List, Max: 1) A set of profiling settings (see the operationProfiling option). (see below for nested schema)
  • oplog (Block List, Max: 1) A set of oplog settings (see the oplog option). (see below for nested schema)
  • set_parameter (Block List) A set of MongoDB Server Parameters (see the setParameter option). (see below for nested schema)
  • storage (Block List, Max: 1) A set of storage settings (see the storage option). (see below for nested schema)

Nested Schema for Nested Schema for cluster_config.mongocfg.audit_log

Optional:

  • filter (String) Configuration of the audit log filter in JSON format. For more information see auditLog.filter description in the official documentation. Available only in enterprise edition.

Nested Schema for Nested Schema for cluster_config.mongocfg.net

Optional:

  • max_incoming_connections (Number) The maximum number of simultaneous connections that host will accept. For more information, see the net.maxIncomingConnections description in the official documentation.

Nested Schema for Nested Schema for cluster_config.mongocfg.operation_profiling

Optional:

  • mode (String) Specifies which operations should be profiled. The following profiler levels are available: off, slow_op, all. For more information, see the operationProfiling.mode description in the official documentation.
  • slow_op_threshold (Number) The slow operation time threshold, in milliseconds. Operations that run for longer than this threshold are considered slow. For more information, see the operationProfiling.slowOpThresholdMs description in the official documentation.

Nested Schema for Nested Schema for cluster_config.mongocfg.oplog

Optional:

  • max_size_percent (Number) The maximum size of the oplog, as a percentage of the total storage size. For more information, see the oplog.oplogSizeMB description in the official documentation.
  • min_retention_hours (Number) The minimum number of hours to preserve an oplog entry, where decimal values represent the fractions of an hour. For more information, see the oplog.minRetentionHours description in the official documentation.

Nested Schema for Nested Schema for cluster_config.mongocfg.set_parameter

Optional:

  • audit_authorization_success (Boolean) Enables the auditing of authorization successes. Can be either true or false. For more information, see the auditAuthorizationSuccess description in the official documentation. Available only in enterprise edition.
  • enable_flow_control (Boolean) Enables the flow control. Can be either true or false. For more information, see the enableFlowControl description in the official documentation.

Nested Schema for Nested Schema for cluster_config.mongocfg.storage

Optional:

  • wired_tiger (Block List, Max: 1) The WiredTiger engine settings. (see the storage.wiredTiger option). (see below for nested schema)

Nested Schema for Nested Schema for cluster_config.mongocfg.storage.wired_tiger

Optional:

  • cache_size (Number) Defines the maximum size of the internal cache that WiredTiger will use for all data in percents. For more information, see the storage.wiredTiger.engineConfig.cacheSize description in the official documentation.
  • cache_size_gb (Number) Defines the maximum size of the internal cache that WiredTiger will use for all data. For more information, see the storage.wiredTiger.engineConfig.cacheSizeGB description in the official documentation.

Nested Schema for Nested Schema for cluster_config.mongod

Optional:

  • audit_log (Block List, Max: 1) A set of audit log settings (see the auditLog option). Available only in enterprise edition. (see below for nested schema)
  • chaining_allowed (Boolean) Chained replication setting. For more information, see the chainingAllowed description in the official documentation.
  • net (Block List, Max: 1) A set of network settings (see the net option). (see below for nested schema)
  • operation_profiling (Block List, Max: 1) A set of profiling settings (see the operationProfiling option). (see below for nested schema)
  • oplog (Block List, Max: 1) A set of oplog settings (see the oplog option). (see below for nested schema)
  • security (Block List, Max: 1) A set of MongoDB Security settings (see the security option). Available only in enterprise edition. (see below for nested schema)
  • set_parameter (Block List, Max: 1) A set of MongoDB Server Parameters (see the setParameter option). (see below for nested schema)
  • storage (Block List, Max: 1) A set of storage settings (see the storage option). (see below for nested schema)

Nested Schema for Nested Schema for cluster_config.mongod.audit_log

Optional:

  • filter (String) Configuration of the audit log filter in JSON format. For more information see auditLog.filter description in the official documentation. Available only in enterprise edition.
  • runtime_configuration (Boolean) Specifies if a node allows runtime configuration of audit filters and the auditAuthorizationSuccess variable. For more information see auditLog.runtimeConfiguration description in the official documentation. Available only in enterprise edition.

Nested Schema for Nested Schema for cluster_config.mongod.net

Optional:

  • compressors (List of String) Specifies the default compressor(s) to use for communication between this mongod or mongos. Accepts array of compressors. Order matters. Available compressors: snappy, zlib, zstd, disabled. To disable network compression, make disabled the only value. For more information, see the net.Compression.Compressors description in the official documentation.
  • max_incoming_connections (Number) The maximum number of simultaneous connections that host will accept. For more information, see the net.maxIncomingConnections description in the official documentation.

Nested Schema for Nested Schema for cluster_config.mongod.operation_profiling

Optional:

  • mode (String) Specifies which operations should be profiled. The following profiler levels are available: off, slow_op, all. For more information, see the operationProfiling.mode description in the official documentation.
  • slow_op_sample_rate (Number) The fraction of slow operations that should be profiled or logged. Accepts values between 0 and 1, inclusive. For more information, see the operationProfiling.slowOpSampleRate description in the official documentation.
  • slow_op_threshold (Number) The slow operation time threshold, in milliseconds. Operations that run for longer than this threshold are considered slow. For more information, see the operationProfiling.slowOpThresholdMs description in the official documentation.

Nested Schema for Nested Schema for cluster_config.mongod.oplog

Optional:

  • max_size_percent (Number) The maximum size of the oplog, as a percentage of the total storage size. For more information, see the oplog.oplogSizeMB description in the official documentation.
  • min_retention_hours (Number) The minimum number of hours to preserve an oplog entry, where decimal values represent the fractions of an hour. For more information, see the oplog.minRetentionHours description in the official documentation.

Nested Schema for Nested Schema for cluster_config.mongod.security

Optional:

  • enable_encryption (Boolean) Enables the encryption for the WiredTiger storage engine. Can be either true or false. For more information see security.enableEncryption description in the official documentation. Available only in enterprise edition.
  • kmip (Block List, Max: 1) Configuration of the third party key management appliance via the Key Management Interoperability Protocol (KMIP) (see Encryption tutorial ). Requires enable_encryption to be true. The structure is documented below. Available only in enterprise edition. (see below for nested schema)

Nested Schema for Nested Schema for cluster_config.mongod.security.kmip

Optional:

  • client_certificate (String) String containing the client certificate used for authenticating MongoDB to the KMIP server. For more information see security.kmip.clientCertificateFile description in the official documentation.
  • key_identifier (String) Unique KMIP identifier for an existing key within the KMIP server. For more information see security.kmip.keyIdentifier description in the official documentation.
  • port (Number) Port number to use to communicate with the KMIP server. Default: 5696 For more information see security.kmip.port description in the official documentation.
  • server_ca (String) Path to CA File. Used for validating secure client connection to KMIP server. For more information see security.kmip.serverCAFile description in the official documentation.
  • server_name (String) Hostname or IP address of the KMIP server to connect to. For more information see security.kmip.serverName description in the official documentation.

Nested Schema for Nested Schema for cluster_config.mongod.set_parameter

Optional:

  • audit_authorization_success (Boolean) Enables the auditing of authorization successes. Can be either true or false. For more information, see the auditAuthorizationSuccess description in the official documentation. Available only in enterprise edition.
  • enable_flow_control (Boolean) Enables the flow control. Can be either true or false. For more information, see the enableFlowControl description in the official documentation.
  • flow_control_target_lag_seconds (Number) The target maximum majority committed lag when running with flow control. For more information, see the flowControlTargetLagSeconds description in the official documentation.
  • flow_control_warn_threshold_seconds (Number) The amount of time to wait to log a warning once the flow control mechanism detects the majority commit point has not moved. For more information, see the flowControlWarnThresholdSeconds description in the official documentation.
  • migrate_clone_insertion_batch_delay_ms (Number) Time in milliseconds to wait between batches of insertions during cloning step of the migration process. For more information, see the migrateCloneInsertionBatchDelayMs description in the official documentation.
  • migrate_clone_insertion_batch_size (Number) The maximum number of documents to insert in a single batch during the cloning step of the migration process. For more information, see the migrateCloneInsertionBatchSize description in the official documentation.
  • min_snapshot_history_window_in_seconds (Number) The minimum time window in seconds for which the storage engine keeps the snapshot history. For more information, see the minSnapshotHistoryWindowInSeconds description in the official documentation.
  • mirror_reads (Block List, Max: 1) A set of MongoDB Mirror Reads settings (see the mirrorReads option). (see below for nested schema)
  • orphan_cleanup_delay_secs (Number) Minimum delay before a migrated chunk is deleted from the source shard. For more information, see the orphanCleanupDelaySecs description in the official documentation.
  • persisted_chunk_cache_update_max_batch_size (Number) Specifies the maximum batch size used for updating the persisted chunk cache. For more information, see the persistedChunkCacheUpdateMaxBatchSize description in the official documentation.
  • range_deleter_batch_delay_ms (Number) The amount of time in milliseconds to wait before the next batch of deletion during the cleanup stage of chunk migration (or the cleanupOrphaned command). For more information, see the rangeDeleterBatchDelayMS description in the official documentation.
  • range_deleter_batch_size (Number) The maximum number of documents in each batch to delete during the cleanup stage of chunk migration (or the cleanupOrphaned command). For more information, see the rangeDeleterBatchSize description in the official documentation.

Nested Schema for Nested Schema for cluster_config.mongod.set_parameter.mirror_reads

Optional:

  • max_time_ms (Number) The maximum time in milliseconds for the mirrored reads. For more information see mirrorReads.maxTimeMS description in the official documentation
  • sampling_rate (Number) The sampling rate used to mirror a subset of operations that support mirroring. For more information see mirrorReads.samplingRate description in the official documentation

Nested Schema for Nested Schema for cluster_config.mongod.storage

Optional:

  • journal (Block List, Max: 1) The durability journal to ensure data files remain valid and recoverable. (see below for nested schema)
  • wired_tiger (Block List, Max: 1) The WiredTiger engine settings. (see the storage.wiredTiger option). These settings available only on mongod hosts. (see below for nested schema)

Nested Schema for Nested Schema for cluster_config.mongod.storage.journal

Optional:

  • commit_interval (Number) The maximum amount of time in milliseconds that the mongod process allows between journal operations. For more information, see the storage.journal.commitIntervalMs description in the official documentation.

Nested Schema for Nested Schema for cluster_config.mongod.storage.wired_tiger

Optional:

  • block_compressor (String) Specifies the default compression for collection data. You can override this on a per-collection basis when creating collections. Available compressors are: none, snappy, zlib, zstd. This setting available only on mongod hosts. For more information, see the storage.wiredTiger.collectionConfig.blockCompressor description in the official documentation.
  • cache_size (Number) Defines the maximum size of the internal cache that WiredTiger will use for all data in percents. For more information, see the storage.wiredTiger.engineConfig.cacheSize description in the official documentation.
  • cache_size_gb (Number) Defines the maximum size of the internal cache that WiredTiger will use for all data. For more information, see the storage.wiredTiger.engineConfig.cacheSizeGB description in the official documentation.
  • prefix_compression (Boolean) Enables or disables prefix compression for index data. Сan be either true or false. For more information, see the storage.wiredTiger.indexConfig.prefixCompression description in the official documentation.

Nested Schema for Nested Schema for cluster_config.mongos

Optional:

  • audit_log (Block List, Max: 1) A set of audit log settings (see the auditLog option). Available only in enterprise edition. (see below for nested schema)
  • chunk_size (Number) The size of the chunk, in bytes. For more information, see the chunkSize description in the official documentation.
  • net (Block List, Max: 1) A set of network settings (see the net option). (see below for nested schema)
  • set_parameter (Block List, Max: 1) A set of MongoDB Server Parameters (see the setParameter option). (see below for nested schema)

Nested Schema for Nested Schema for cluster_config.mongos.audit_log

Optional:

  • filter (String) Configuration of the audit log filter in JSON format. For more information see auditLog.filter description in the official documentation. Available only in enterprise edition.

Nested Schema for Nested Schema for cluster_config.mongos.net

Optional:

  • compressors (List of String) Specifies the default compressor(s) to use for communication between this mongod or mongos. Accepts array of compressors. Order matters. Available compressors: snappy, zlib, zstd, disabled. To disable network compression, make disabled the only value. For more information, see the net.Compression.Compressors description in the official documentation.
  • max_incoming_connections (Number) The maximum number of simultaneous connections that host will accept. For more information, see the net.maxIncomingConnections description in the official documentation.

Nested Schema for Nested Schema for cluster_config.mongos.set_parameter

Optional:

  • audit_authorization_success (Boolean) Enables the auditing of authorization successes. Can be either true or false. For more information, see the auditAuthorizationSuccess description in the official documentation. Available only in enterprise edition.
  • read_hedging_mode (String) Specifies whether mongos supports hedged reads for those read operations whose read preference have enabled the hedged read option. For more information, see the readHedgingMode description in the official documentation.
  • sharding_task_executor_pool_host_timeout_ms (Number) Maximum time that mongos goes without communication to a host before mongos drops all connections to the host. For more information, see the shardingTaskExecutorPoolHostTimeoutMS description in the official documentation.
  • sharding_task_executor_pool_max_connecting (Number) Maximum number of simultaneous initiating connections (including pending connections in setup/refresh state) each TaskExecutor connection pool can have to a mongod instance. For more information, see the shardingTaskExecutorPoolMaxConnecting description in the official documentation.
  • sharding_task_executor_pool_max_size (Number) Maximum number of outbound connections each TaskExecutor connection pool can open to any given mongod instance. For more information, see the shardingTaskExecutorPoolMaxSize description in the official documentation.
  • sharding_task_executor_pool_max_size_for_config_servers (Number) Optional override for ShardingTaskExecutorPoolMaxSize to set the maximum number of outbound connections each TaskExecutor connection pool can open to a configuration server. For more information, see the shardingTaskExecutorPoolMaxSizeForConfigServers description in the official documentation.
  • sharding_task_executor_pool_min_size (Number) Minimum number of outbound connections each TaskExecutor connection pool can open to any given mongod instance. For more information, see the shardingTaskExecutorPoolMinSize description in the official documentation.
  • sharding_task_executor_pool_min_size_for_config_servers (Number) Optional override for ShardingTaskExecutorPoolMinSize to set the minimum number of outbound connections each TaskExecutor connection pool can open to a configuration server. For more information, see the shardingTaskExecutorPoolMinSizeForConfigServers description in the official documentation.
  • sharding_task_executor_pool_refresh_requirement_ms (Number) Maximum time the mongos waits before attempting to heartbeat an idle connection in the pool. For more information, see the shardingTaskExecutorPoolRefreshRequirementMS description in the official documentation.
  • sharding_task_executor_pool_refresh_timeout_ms (Number) Maximum time the mongos waits for a heartbeat before timing out the heartbeat. For more information, see the shardingTaskExecutorPoolRefreshTimeoutMS description in the official documentation.
  • sharding_task_executor_pool_replica_set_matching (String) On a mongos instance, this parameter sets the policy that determines the minimum size limit of its connection pools to nodes within replica sets. For more information, see the shardingTaskExecutorPoolReplicaSetMatching description in the official documentation.
  • warm_min_connections_in_sharding_task_executor_pool_on_startup (Boolean) Configures a mongos instance to prewarm its connection pool on startup. For more information, see the warmMinConnectionsInShardingTaskExecutorPoolOnStartup description in the official documentation.
  • warm_min_connections_in_sharding_task_executor_pool_on_startup_wait_ms (Number) Sets the timeout threshold in milliseconds for a mongos to wait for ShardingTaskExecutorPoolMinSize connections to be established per shard host when using the warmMinConnectionsInShardingTaskExecutorPoolOnStartup parameter. For more information, see the warmMinConnectionsInShardingTaskExecutorPoolOnStartupWaitMS description in the official documentation.

Nested Schema for Nested Schema for cluster_config.performance_diagnostics

Optional:

  • enabled (Boolean) Enable or disable performance diagnostics.

Nested Schema for Nested Schema for host

Required:

  • 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.
  • zone_id (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) Should this host have assigned public IP assigned. Can be either true or false.
  • host_parameters (Block List, Max: 1) The parameters of mongod host in replicaset. (see below for nested schema)
  • role (String) The role of the cluster (either PRIMARY or SECONDARY).
  • shard_name (String) The name of the shard to which the host belongs. Only for sharded cluster.
  • type (String) Type of Mongo daemon which runs on this host (mongod, mongos, mongocfg, mongoinfra). Defaults to mongod.

Read-Only:

  • health (String) The health of the host.
  • name (String) The fully qualified domain name of the host. Computed on server side.

Nested Schema for Nested Schema for host.host_parameters

Optional:

  • hidden (Boolean) Should this host be hidden in replicaset. Can be either true of false. For more information see the official documentation.
  • priority (Number) A floating point number that indicates the relative likelihood of a replica set member to become the primary. For more information see the official documentation.
  • secondary_delay_secs (Number) The number of seconds behind the primary that this replica set member should lag. For more information see the official documentation.
  • tags (Map of String) A set of key/value pairs to assign for the replica set member. For more information see the official documentation.

Nested Schema for Nested Schema for database

Required:

  • name (String) The name of the database.

Nested Schema for Nested Schema for disk_size_autoscaling_mongocfg

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 disk_size_autoscaling_mongod

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 disk_size_autoscaling_mongoinfra

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 disk_size_autoscaling_mongos

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 resources

Required:

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

Nested Schema for Nested Schema for resources_mongocfg

Required:

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

Nested Schema for Nested Schema for resources_mongod

Required:

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

Nested Schema for Nested Schema for resources_mongoinfra

Required:

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

Nested Schema for Nested Schema for resources_mongos

Required:

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

Nested Schema for Nested Schema for restore

Required:

  • backup_id (String) Backup ID. The cluster will be created from the specified backup. How to get a list of PostgreSQL backups.

Optional:

  • time (String) Timestamp of the moment to which the MongoDB cluster should be restored. (Format: 2006-01-02T15:04:05 - UTC). When not set, current time is used.

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

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 (List of String) The roles of the user in this database. For more information see the official documentation.

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_mongodb_cluster.<resource Name> <resource Id>
terraform import yandex_mdb_mongodb_cluster.my_cluster ...

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

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