Skip to content

Azure Database for MySQL is a fully managed relational database service provided by Microsoft Azure. This module is designed to handle demanding workloads, ensuring high availability, security, and performance for your MySQL-powered applications.

License

Notifications You must be signed in to change notification settings

squareops/terraform-azurerm-mysql-azure

Repository files navigation

Azure Database for MYSQL

squareops_avatar

SquareOps Technologies Your DevOps Partner for Accelerating cloud journey.


Azure Database for MySQL is a fully managed relational database service provided by Microsoft Azure. It allows you to deploy, manage, and scale MySQL databases in the cloud without the overhead of server maintenance and management. This service is designed to handle demanding workloads, ensuring high availability, security, and performance for your MySQL-powered applications.

Features

1. Managed Service

Azure Database for MySQL takes care of routine database tasks such as backups, updates, patching, and monitoring. This allows you to focus on developing your applications rather than managing the underlying infrastructure.

2. High Availability

The service provides built-in high availability with automatic failover. In the event of a server failure, your database will be automatically switched to a standby server to minimize downtime and ensure data integrity.

3. Scalability

Scale your database up or down based on your application's needs without significant downtime. Azure Database for MySQL supports both vertical and horizontal scaling, allowing you to adjust compute and storage resources as required.

4. Security

Security is a top priority. The service offers features such as data encryption at rest and in transit, firewall rules, virtual network integration, and support for Azure Active Directory authentication for enhanced access control.

5. Automatic Backups

Azure Database for MySQL performs automatic backups of your data, allowing you to restore your database to a specific point in time if needed. You can configure retention periods and backup frequency according to your business requirements.

6. Geo-Replication

Enable read replicas in different Azure regions to distribute read traffic and improve application performance. This also provides disaster recovery capabilities by promoting a replica to a primary server in case of a regional outage.

7. Advanced Monitoring and Insights

Gain insights into the performance and health of your MySQL database through Azure Monitor. Metrics and logs help you identify and troubleshoot issues, optimize performance, and plan for future resource needs.

8. Global Reach

Azure Database for MySQL is available in multiple Azure regions worldwide. This allows you to place your database near your users for reduced latency and compliance with data residency requirements.

9. Compatibility

The service is designed to be compatible with MySQL, ensuring that your existing MySQL applications can seamlessly migrate to Azure Database for MySQL without major modifications.

10. Flexible Development

Integrate Azure Database for MySQL with popular development tools, frameworks, and languages. This includes support for popular libraries and connectors, making it easy to build applications that connect to your managed MySQL instance.

Usage Example

module "mysql_flexible" {
  source                       = "squareops/mysql/azurerm"
  name                         = "mysql-flexible"
  environment                  = "prod"
  resource_group_name          = "mysql-flexible-rg" # Specify the name of the resource group to be created
  resource_group_location      = "eastus"         # Specify the region of the resource group to be created
  create_vnet                  = "false"          # set "true" to create a fresh vnet for the database server.
  vnet_resource_group_name     = "demo-rg"        # If vnet creation is set to false, specify the resource group name where vnet is present.
  vnet_name                    = "vnet-test"      # If vnet creation is set to false, specify the vnet name here.
  vnet_id                      = ""               # If vnet creation is set to false, specify the vnet id here.
  vnet_address_space           = "10.10.0.0/16"   # vnet will be created with specified CIDR's. Do not specify while passing existing vnet resource group, name & id
  subnet_cidr                  = "10.20.3.0/28"   # New subnet will be created with "Microsoft.Storage" service endpoint.
  administrator_username       = "adminuser"
  administrator_password       = "Password@123"
  mysql_version                = "8.0.21"
  zones                        = "2"
  storage_size_gb              = "128"
  sku_name                     = "GP_Standard_D4ds_v4"
  backup_retention_days        = "30"
  iops                         = "5000"
  auto_grow_enabled            = true # Auto scale storage
  geo_redundant_backup_enabled = true
  db_collation                 = "utf8_unicode_ci"
  db_charset                   = "utf8"
  diagnostics_enabled          = "true" # For logging and monitoring
  start_ip_address             = "10.20.3.0"
  end_ip_address               = "10.20.3.255"
  maintenance_window = {
    day_of_week  = 3
    start_hour   = 3
    start_minute = 0
  }
  tags = { Name = SKAF, Department = Engineering}
}

Refer examples for more details

Permissions

Required permissions to create resources from this module are mentioned here

Requirements

Name Version
terraform >= 1.3
azurerm ~> 3.22

Providers

Name Version
azurerm ~> 3.22

Modules

No modules.

Resources

Name Type
azurerm_log_analytics_workspace.example resource
azurerm_monitor_diagnostic_setting.mysql_server resource
azurerm_mysql_flexible_database.mysql resource
azurerm_mysql_flexible_server.mysql resource
azurerm_mysql_flexible_server_configuration.mysql resource
azurerm_mysql_flexible_server_firewall_rule.mysql resource
azurerm_private_dns_zone.default resource
azurerm_private_dns_zone_virtual_network_link.default resource
azurerm_resource_group.default resource
azurerm_subnet.default resource
azurerm_user_assigned_identity.mysql resource
azurerm_virtual_network.default resource
azurerm_monitor_diagnostic_categories.mysql_server data source

Inputs

Name Description Type Default Required
administrator_password Administrator password for the MySQL server. string "" no
administrator_username Administrator username for the MySQL server. string "" no
auto_grow_enabled Enable auto grow for storage. bool true no
backup_retention_days Number of days to retain backups. string "30" no
create_vnet Set to 'true' to create a fresh VNet for the database server. bool false no
db_charset Character set for the MySQL database. string "utf8" no
db_collation Collation for the MySQL database. string "utf8_unicode_ci" no
diagnostics_enabled Enable diagnostics for logging and monitoring. bool false no
end_ip_address End IP address for the firewall rule. string "" no
environment Enviornment tag of the pg server string "" no
geo_redundant_backup_enabled Enable geo-redundant backups. bool true no
iops IOPS for storage. string "5000" no
location Location of the resource. string "eastus" no
maintenance_window Maintenance window settings. map(any)
{
"day_of_week": 3,
"start_hour": 3,
"start_minute": 0
}
no
mysql_configurations n/a map(string)
{
"innodb_buffer_pool_size": "12884901888",
"max_allowed_packet": "536870912",
"table_definition_cache": "5000",
"table_open_cache": "5000"
}
no
mysql_version Version of MySQL server. string "8.0.21" no
name Prefix of the resource name. string "" no
resource_group_location Specify the region of the resource group to be created string "" no
resource_group_name Specify the name of the resource group to be created string "pg-flexible" no
sku_name SKU name for the MySQL server. string "" no
start_ip_address Start IP address for the firewall rule. string "" no
storage_size_gb Storage size in GB for the MySQL server. string "128" no
subnet_cidr New subnet will be created with 'Microsoft.Storage' service endpoint. string "" no
tags The tags to associate with your network and subnets. map(string)
{
"tag1": "",
"tag2": ""
}
no
vnet_address_space VNet will be created with specified CIDR ranges. Do not specify while passing an existing VNet resource group, name, and ID. string "" no
vnet_id If VNet creation is set to false, specify the VNet ID here. string "" no
vnet_name If VNet creation is set to false, specify the VNet name here. string "" no
vnet_resource_group_name If VNet creation is set to false, specify the resource group name where the VNet is present. string "" no
zones Availability zones for the MySQL server. string "2" no

Outputs

Name Description
diagnostic_setting_name Name of the created Diagnostic Setting for the MySQL Flexible Server.
log_analytics_workspace_name Name of the created Log Analytics Workspace for diagnostics.
mysql_configuration_settings Configuration settings applied to the MySQL Flexible Server.
mysql_database_name Name of the created MySQL Database within the Flexible Server.
mysql_firewall_rule_name Name of the created Firewall Rule for the MySQL Flexible Server.
mysql_server_name Name of the created Azure MySQL Flexible Server.
private_dns_zone_name Name of the created Private DNS Zone.
private_dns_zone_virtual_network_link_name Name of the created Private DNS Zone Virtual Network Link.
resource_group_name Name of the created Azure Resource Group.
subnet_name Name of the created Azure Subnet.
user_assigned_identity_name Name of the created User Assigned Identity.
virtual_network_name Name of the created Azure Virtual Network, if applicable.

Contribute & Issue Report

To report an issue with a project:

  1. Check the repository's issue tracker on GitHub
  2. Search to check if the issue has already been reported
  3. If you can't find an answer to your question in the documentation or issue tracker, you can ask a question by creating a new issue. Make sure to provide enough context and details.

License

Apache License, Version 2.0, January 2004 (https://www.apache.org/licenses/LICENSE-2.0)

Support Us

To support our GitHub project by liking it, you can follow these steps:

  1. Visit the repository: Navigate to the GitHub repository

  2. Click the "Star" button: On the repository page, you'll see a "Star" button in the upper right corner. Clicking on it will star the repository, indicating your support for the project.

  3. Optionally, you can also leave a comment on the repository or open an issue to give feedback or suggest changes.

Staring a repository on GitHub is a simple way to show your support and appreciation for the project. It also helps to increase the visibility of the project and make it more discoverable to others.

Who we are

We believe that the key to success in the digital age is the ability to deliver value quickly and reliably. That’s why we offer a comprehensive range of DevOps & Cloud services designed to help your organization optimize its systems & Processes for speed and agility.

  1. We are an AWS Advanced consulting partner which reflects our deep expertise in AWS Cloud and helping 100+ clients over the last 5 years.
  2. Expertise in Kubernetes and overall container solution helps companies expedite their journey by 10X.
  3. Infrastructure Automation is a key component to the success of our Clients and our Expertise helps deliver the same in the shortest time.
  4. DevSecOps as a service to implement security within the overall DevOps process and helping companies deploy securely and at speed.
  5. Platform engineering which supports scalable,Cost efficient infrastructure that supports rapid development, testing, and deployment.
  6. 24*7 SRE service to help you Monitor the state of your infrastructure and eradicate any issue within the SLA.

We provide support on all of our projects, no matter how small or large they may be.

To find more information about our company, visit squareops.com, follow us on Linkedin, or fill out a job application. If you have any questions or would like assistance with your cloud strategy and implementation, please don't hesitate to contact us.

About

Azure Database for MySQL is a fully managed relational database service provided by Microsoft Azure. This module is designed to handle demanding workloads, ensuring high availability, security, and performance for your MySQL-powered applications.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages