Provides a virtual resource that can be used to change advanced configuration options for a DigitalOcean managed MongoDB database cluster.
-> Note MongoDB configurations are only removed from state when destroyed. The remote configuration is not unset.
resource "digitalocean_database_mongodb_config" "example" {
cluster_id = digitalocean_database_cluster.example.id
default_read_concern = "majority"
default_write_concern = "majority"
transaction_lifetime_limit_seconds = 100
slow_op_threshold_ms = 100
verbosity = 3
}
resource "digitalocean_database_cluster" "example" {
name = "example-mongodb-cluster"
engine = "mongodb"
version = "7"
size = "db-s-1vcpu-1gb"
region = "nyc3"
node_count = 1
}
The following arguments are supported. See the DigitalOcean API documentation for additional details on each option.
cluster_id
- (Required) The ID of the target MongoDB cluster.default_read_concern
- (Optional) Specifies the default consistency behavior of reads from the database. Data that is returned from the query with may or may not have been acknowledged by all nodes in the replicaset depending on this value. Learn more here.default_write_concern
- (Optional) Describes the level of acknowledgment requested from MongoDB for write operations clusters. This field can set to either majority
or a number0...n
which will describe the number of nodes that must acknowledge the write operation before it is fully accepted. Setting to 0
will request no acknowledgement of the write operation. Learn more here.transaction_lifetime_limit_seconds
- (Optional) Specifies the lifetime of multi-document transactions. Transactions that exceed this limit are considered expired and will be aborted by a periodic cleanup process. The cleanup process runs every transactionLifetimeLimitSeconds/2 seconds
or at least once every 60 seconds. Changing this parameter will lead to a restart of the MongoDB service. Learn more here.slow_op_threshold_ms
- (Optional) Operations that run for longer than this threshold are considered slow which are then recorded to the diagnostic logs. Higher log levels (verbosity) will record all operations regardless of this threshold on the primary node. Changing this parameter will lead to a restart of the MongoDB service. Learn more here.verbosity
- (Optional) The log message verbosity level. The verbosity level determines the amount of Informational and Debug messages MongoDB outputs. 0 includes informational messages while 1…5 increases the level to include debug messages. Changing this parameter will lead to a restart of the MongoDB service. Learn more here.All above attributes are exported. If an attribute was set outside of Terraform, it will be computed.
A MongoDB database cluster’s configuration can be imported using the id
the parent cluster, e.g.
terraform import digitalocean_database_mongodb_config.example 4b62829a-9c42-465b-aaa3-84051048e712