Skip to content

blackbird-cloud/terraform-azurerm-mysql-server

Repository files navigation

Terraform Azurerm Mysql Server Module

Terraform module to create an Azure MySQL Server

blackbird-logo

Example

locals {
  network = {
    vnet_id   = "vnet-123"
    subnet_id = "subnet-456"
  }
}

module "mysql_server" {
  source  = "blackbird-cloud/mysql-server/azurerm"
  version = "~> 1"

  resource_group_name     = "myresourcegroup"
  resource_group_location = "westeurope"

  vnet_id   = local.network.vnet_id
  subnet_id = local.network.subnet_id

  sku = "GP_Standard_D2ds_v4"

  name = "mysqlserver"

  maintenance_window = {
    day_of_week  = 0
    start_hour   = 8
    start_minute = 0
  }

  storage = {
    iops    = 360
    size_gb = 20
  }
}

Requirements

Name Version
terraform >= 1.2
azurerm ~>3
random ~>3

Providers

Name Version
azurerm ~>3
random ~>3

Resources

Name Type
azurerm_mysql_flexible_database.main resource
azurerm_mysql_flexible_server.default resource
azurerm_private_dns_zone.default resource
azurerm_private_dns_zone_virtual_network_link.default resource
random_password.password resource
random_string.name resource

Inputs

Name Description Type Default Required
high_availablity (Optional) The high availability zone for the MySQL server. string "SameZone" no
maintenance_window (Optional) The maintenance window for the MySQL server.
object({
day_of_week = number
start_hour = number
start_minute = number
})
{
"day_of_week": 0,
"start_hour": 8,
"start_minute": 0
}
no
mysql_version (Optional) The version of the MySQL server. string "8.0.21" no
name (Optional) The name of the MySQL server. string "" no
resource_group_location (Required) Location of the resource group. string "westeurope" no
resource_group_name (Required) The name of the resource group in which to create the MySQL server. string n/a yes
sku (Optional) The SKU name for the MySQL server. string "GP_Standard_D2ds_v4" no
storage (Optional) The storage configuration for the MySQL server.
object({
auto_grow_enabled = optional(bool)
io_scaling_enabled = optional(bool)
iops = optional(number)
size_gb = optional(number)
})
{
"auto_grow_enabled": true,
"io_scaling_enabled": false,
"iops": 360,
"size_gb": 20
}
no
subnet_id (Required) The ID of the subnet where the MySQL server should be deployed. string n/a yes
vnet_id (Required)The ID of the virtual network where the MySQL server should be deployed. string n/a yes

Outputs

Name Description
admin_login The admin username for the MySQL server.
admin_password The admin password for the MySQL server.
azurerm_mysql_flexible_server The name of the MySQL Flexible Server.
mysql_flexible_server_database_name The name of the MySQL Flexible Server Database.

About

We are Blackbird Cloud, Amsterdam based cloud consultancy, and cloud management service provider. We help companies build secure, cost efficient, and scale-able solutions.

Checkout our other 👉 terraform modules

Copyright

Copyright © 2017-2024 Blackbird Cloud

About

Terraform module to create an Azure MySQL Server

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages