Skip to content

SoftcatMS/terraform-azure-mysql

Repository files navigation

terraform-azure-mysql

Deployes a MYSQL Database in Azure

Based of original module: https://github.com/avinor/terraform-azurerm-vpn

It supports creating:

  • Mysql server
  • Mysql database

Usage Examples

Review the examples folder: examples

Deployment

Perform the following commands on the root folder:

  • terraform init to get the plugins
  • terraform plan to see the infrastructure plan
  • terraform apply to apply the infrastructure build
  • terraform destroy to destroy the built infrastructure

< use terraform-docs to create Inputs and Outpus documentation terraform-docs

terraform-docs markdown .

Requirements

Installed Software

The following dependencies must be installed on the development system:

Azure

Providers

Name Version
azurerm n/a
random n/a

Modules

No modules.

Resources

Name Type
azurerm_mysql_database.mysql_database resource
azurerm_mysql_server.mysql_server resource
random_string.unique resource

Inputs

Name Description Type Default Required
administrator_login MySQL administrator login string n/a yes
administrator_login_password MySQL administrator password. Strong Password: https://docs.microsoft.com/en-us/sql/relational-databases/security/strong-passwords?view=sql-server-2017 string n/a yes
auto_grow_enabled Enable/Disable auto-growing of the storage. bool false no
backup_retention_days Backup retention days for the server, supported values are between 7 and 35 days. number 10 no
create_mode The creation mode. Can be used to restore or replicate existing servers. Possible values are Default, Replica, GeoRestore, and PointInTimeRestore. string "Default" no
creation_source_server_id For creation modes other than Default. The source server ID to use. string null no
databases Databases to be deployed on Mysql instance.
map(object({
resource_group_name = string
charset = string
collation = string
}))
{} no
encryption_enabled Whether or not infrastructure is encrypted for this server. Defaults to false. Changing this forces a new resource to be created. bool false no
force_ssl Force usage of SSL bool true no
geo_redundant_backup_enabled Turn Geo-redundant server backups on/off. Not available for the Basic tier. bool true no
location Azure location for Key Vault. string n/a yes
mysql_version Valid values are 5.6 and 5.7 string "5.7" no
name Name of the MySQL Server. Changing this forces a new resource to be created string n/a yes
public_access Whether or not public network access is allowed for this server. Defaults to true. bool true no
random_suffix Boolean flag which controls if random string appened to name. bool false no
resource_group_name Name of the application ressource group, herited from infra module string n/a yes
restore_point_in_time When create_mode is PointInTimeRestore, specifies the point in time to restore from creation_source_server_id. string null no
sku_name Azure database for MySQL sku name string "GP_Gen5_2" no
ssl_minimal_tls_version_enforced The minimum TLS version to support on the sever. Possible values are TLSEnforcementDisabled, TLS1_0, TLS1_1, and TLS1_2. Defaults to TLSEnforcementDisabled. string "TLSEnforcementDisabled" no
storage_mb Max storage allowed for a server. Possible values are between 5120 MB(5GB) and 1048576 MB(1TB) for the Basic SKU and between 5120 MB(5GB) and 4194304 MB(4TB) for General Purpose/Memory Optimized SKUs. number 5120 no
tags Tags to apply to all resources created. map(string) {} no

Outputs

Name Description
name Mysql server name

Contributing

Refer to the contribution guidelines for information on contributing to this module.