Skip to content

claranet/terraform-azurerm-mongo-cluster

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MongoDB Cluster

Changelog Notice Apache V2 License OpenTofu Registry

Azure module to deploy a MongoDB Cluster using vCore Architecture.

Global versioning rule for Claranet Azure modules

Module version Terraform version OpenTofu version AzureRM version
>= 8.x.x Unverified 1.8.x >= 4.0
>= 7.x.x 1.3.x >= 3.0
>= 6.x.x 1.x >= 3.0
>= 5.x.x 0.15.x >= 2.0
>= 4.x.x 0.13.x / 0.14.x >= 2.0
>= 3.x.x 0.12.x >= 2.0
>= 2.x.x 0.12.x < 2.0
< 2.x.x 0.11.x < 2.0

Contributing

If you want to contribute to this repository, feel free to use our pre-commit git hook configuration which will help you automatically update and format some files for you by enforcing our Terraform code module best-practices.

More details are available in the CONTRIBUTING.md file.

Usage

This module is optimized to work with the Claranet terraform-wrapper tool which set some terraform variables in the environment needed by this module. More details about variables set by the terraform-wrapper available in the documentation.

⚠️ Since modules version v8.0.0, we do not maintain/check anymore the compatibility with Hashicorp Terraform. Instead, we recommend to use OpenTofu.

module "mongo_cluster" {
  source  = "claranet/mongo-cluster/azurerm"
  version = "x.x.x"

  location            = module.azure_region.location
  location_short      = module.azure_region.location_short
  resource_group_name = module.rg.name

  client_name = var.client_name
  environment = var.environment
  stack       = var.stack

  administrator_username    = "claranet"
  shard_count               = 1
  compute_tier              = "Free"
  high_availability_enabled = false
  storage_size_in_gb        = 32
  mongodb_version           = "7.0"

  public_network_access_enabled = false

  logs_destinations_ids = [
    module.run.logs_storage_account_id,
    module.run.log_analytics_workspace_id
  ]

  extra_tags = {
    foo = "bar"
  }
}

module "mongo_cluster_replica" {
  source  = "claranet/mongo-cluster/azurerm"
  version = "x.x.x"

  location            = module.azure_region.paired_location.location
  location_short      = module.azure_region.paired_location.location_short
  resource_group_name = module.rg_paired.name

  client_name = var.client_name
  environment = var.environment
  stack       = var.stack

  create_mode      = "GeoReplica"
  source_server_id = module.mongo_cluster.id
  source_location  = module.azure_region.location

  public_network_access_enabled = false

  logs_destinations_ids = [
    module.run.logs_storage_account_id,
    module.run.log_analytics_workspace_id
  ]

  extra_tags = {
    foo = "bar"
  }
}

Providers

Name Version
azurecaf ~> 1.2.29
azurerm ~> 4.23
random >= 2.0

Modules

Name Source Version
diagnostics claranet/diagnostic-settings/azurerm ~> 8.0

Resources

Name Type
azurerm_mongo_cluster.main resource
azurerm_mongo_cluster.replica resource
random_password.administrator_password resource
azurecaf_name.mongo_cluster data source

Inputs

Name Description Type Default Required
administrator_password The Password associated with the administrator_username for the MongoDB Cluster. If not set, password is randomly generated. string null no
administrator_username The administrator username of the MongoDB Cluster. string null no
client_name Client name/account used in naming. string n/a yes
compute_tier The compute tier to assign to the MongoDB Cluster. Possible values are Free, M10, M20, M25, M30, M40, M50, M60, M80, and M200. string "Free" no
create_mode The creation mode for the MongoDB Cluster. Possible values are Default and GeoReplica. string "Default" no
custom_name Custom MongoDB Cluster, generated if not set. string "" no
default_tags_enabled Option to enable or disable default tags. bool true no
diagnostic_settings_custom_name Custom name of the diagnostics settings, name will be default if not set. string "default" no
environment Project environment. string n/a yes
extra_tags Additional tags to add on resources. map(string) {} no
high_availability_enabled Whether the high availability is disabled or enabled (ZoneRedundantPreferred). Note: High availability is only available for M30 tier and above. bool false no
location Azure region to use. string n/a yes
location_short Short string for Azure location. string n/a yes
logs_categories Log categories to send to destinations. list(string) null no
logs_destinations_ids List of destination resources IDs for logs diagnostic destination.
Can be Storage Account, Log Analytics Workspace and Event Hub. No more than one of each can be set.
If you want to use Azure EventHub as a destination, you must provide a formatted string containing both the EventHub Namespace authorization send ID and the EventHub name (name of the queue to use in the Namespace) separated by the | character.
list(string) n/a yes
logs_metrics_categories Metrics categories to send to destinations. list(string) null no
mongodb_version The version for the MongoDB Cluster. Possible values are 5.0, 6.0 and 7.0. string "7.0" no
name_prefix Optional prefix for the generated name. string "" no
name_suffix Optional suffix for the generated name. string "" no
preview_features The preview features that can be enabled on the MongoDB Cluster. list(string) [] no
public_network_access_enabled Whether the MongoDB Cluster is available from public network. bool false no
resource_group_name Name of the resource group. string n/a yes
shard_count The Number of shards to provision on the MongoDB Cluster. number 1 no
source_location The location of the source MongoDB Cluster. Required when create_mode is GeoReplica. string null no
source_server_id The ID of the replication source MongoDB Cluster. Required when create_mode is GeoReplica. string null no
stack Project stack name. string n/a yes
storage_size_in_gb The size of the data disk space for the MongoDB Cluster. Valid values are: 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768. Note: Free tier only supports 32 GiB, M10/M20/M25 tiers support 32, 64, or 128 GiB only, M30+ tiers support all values. number 32 no

Outputs

Name Description
administrator_login The administrator login for the MongoDB Cluster.
administrator_password The administrator password for the MongoDB Cluster.
connection_strings The list of connection strings for the MongoDB Cluster.
id MongoDB Cluster ID.
name MongoDB Cluster name.
resource MongoDB Cluster resource object.

Related documentation

Microsoft Azure documentation: Azure Cosmos DB for MongoDB vCore

About

Terraform module for MongoDB Cluster using vCore Architecture

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages