Skip to content

rhythmictech/terraform-azurerm-mariadb

Repository files navigation

terraform-azurerm-mariadb

Batteries-included MariaDB on Azure

Example

A basic database with unsafe firewall rules and a metric monitor:

module "mariadb" {
  source  = "rhythmictech/mariadb/azurerm"
  version = "v2.1.0"

  administrator_login     = var.administrator_login
  firewall_rules          = {
      unsafe = {
          start_ip = "0.0.0.0"
          end_ip   = h0.0.0.0"
      }
  }
  location                = var.location
  monitor_action_group_id = var.urgent_monitor_action_group_id
  monitor_metric_alert_criteria = {
    cpu_utilization = {
      aggregation = "Maximum"
      metric_name = "CPU"
      operator    = "GreaterThan"
      threshold   = 90
      dimension   = {}
    }
  }
}

Requirements

Name Version
terraform >= 0.12

Providers

Name Version
azurerm n/a
random n/a

Inputs

Name Description Type Default Required
administrator_login The Administrator Login for the MariaDB Server. Changing this forces a new resource to be created. string "" no
administrator_password The Password associated with the administrator_login for the MariaDB Server. string "" no
auto_grow Whether autogrow is enabled string "Enabled" no
backup_retention_days Backup retention days for the server, supported values are between 7 and 35 days. number 7 no
charset Specifies the Charset for the MariaDB Database, which needs to be a valid MariaDB Charset. string "utf8" no
collation Specifies the Collation for the MariaDB Database, which needs to be a valid MariaDB Collation. string "utf8_general_ci" no
dbs Map of databases to create, values supported: name, charset, collation map {} no
firewall_rules Map of firewall rules to create. Key is rule name, values are start_ip, end_ip map {} no
geo_redundant_backup Enable Geo-redundant or not for server backup. Valid values for this property are Enabled or Disabled, not supported for the basic tier. string "Disabled" no
location Specifies the supported Azure location where the resource exists. string "eastus" no
mariadb_configurations Map of MariaDB configuration settings to create. Key is name, value is value. See mariadb.com/kb/en/server-system-variables/ map {} no
monitor_action_group_id ID of Azure Monitor Action Group for metric to trigger string "" no
monitor_metric_alert_criteria Map of name = criteria objects
map(object({
# criteria.*.aggregation to be one of [Average Count Minimum Maximum Total]
aggregation = string
metric_name = string
# criteria.0.operator to be one of [Equals NotEquals GreaterThan GreaterThanOrEqual LessThan LessThanOrEqual]
operator = string
threshold = number

dimension = map(object({
name = string
operator = string
values = list(string)
}))
}))
{} no
name The name of the resource group in which to create the MariaDB Server. string "" no
server_version Specifies the version of MariaDB to use. string "10.3" no
sku_name Specifies the SKU Name for this MariaDB Server. string "B_Gen5_2" no
ssl_enforcement Specifies if SSL should be enforced on connections. Possible values are Enabled and Disabled. string "Enabled" no
storage_mb Max storage allowed for a server. Possible values are:
- between 5120 MB(5GB) and 1048576 MB(1TB) for the Basic SKU
- between 5120 MB(5GB) and 4194304 MB(4TB) for General Purpose/Memory Optimized SKUs
number 5120 no
tags Tags to apply to all resources map(string) {} no
vnet_rules Map of vnet rules to create. Key is name, value is vnet id map {} no

Outputs

Name Description
administrator_login Administrative user name of MariaDB server
administrator_password Password for administrative user name of MariaDB server
monitor_metric_alerts List Azure Monitor Metric Alert resources for the MariaDB Server
resource_group_name Name of MariaDB server resource group
server_fqdn FQDN of MariaDB server
server_id ID of MariaDB server
server_name Name of MariaDB server