Skip to content

dodevops/terraform-azure-mysql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Azure DB for MySQL

Introduction

This module manages resources for Azure DB for MySQL using the flexible server deployment.

More details are available in the following sources:

Usage

Instantiate the module by calling it from Terraform like this:

module "azure-mysql" {
  source = "dodevops/mysql/azure"
  version = "<version>"
}

Requirements

The following requirements are needed by this module:

  • terraform (>=1.0.0)

  • azurerm (>=3.63.0)

Providers

The following providers are used by this module:

  • azurerm (>=3.63.0)

Modules

No modules.

Resources

The following resources are used by this module:

Required Inputs

The following input variables are required:

admin_password

Description: Admin password

Type: string

charset

Description: Charset for the databases, which needs to be a valid MySQL charset

Type: string

collation

Description: Charset for the databases, which needs to be a valid MySQL charset

Type: string

database_suffixes

Description: List of suffixes for databases to be created

Type: list(string)

location

Description: The azure location used for azure

Type: string

project

Description: Three letter project key

Type: string

resource_group

Description: Azure Resource Group to use

Type: string

stage

Description: Stage for this ressource group

Type: string

Optional Inputs

The following input variables are optional (have default values):

admin_login

Description: Admin login

Type: string

Default: "mysqladmin"

allowed_ips

Description: A hash of permissions to access the database server by ip. The hash key is the name suffix and each value
has a start and an end value.

* For public access set start to 0.0.0.0 and end to 255.255.255.255
* To allow access from all Azure services to this database, set start and end to 0.0.0.0

Type:

map(object({
    start = string,
    end   = string
  }))

Default: {}

availability_zone

Description: The availability zone the server will be created in

Type: string

Default: "1"

backup_retention_days

Description: Number of days to keep backups

Type: number

Default: 7

configurations

Description: Additional MySQL configurations

Type: map(string)

Default: {}

database_host_sku

Description: SKU for the database server to use

Type: string

Default: "GP_Standard_D4ds_v4"

database_storage_autogrow

Description: Autogrow storage when limit is reached?

Type: bool

Default: true

database_storage_iops

Description: IO operations per second

Type: number

Default: 3600

database_storage_size

Description: Required database storage (in GB)

Type: string

Default: "20"

database_version

Description: Database version to use

Type: string

Default: "8.0.21"

delegated_subnet_id

Description: The id of a subnet that the server will be created in if private-only access is required.
This subnet requires a service delegation definition like this:

  delegation {
    name = "fs"
    service_delegation {
      name = "Microsoft.DBforMySQL/flexibleServers"
      actions = [
        "Microsoft.Network/virtualNetworks/subnets/join/action",
      ]
    }
  }

Type: string

Default: null

geo_redundant_backup_enabled

Description: Whether backups should be geo redundant

Type: bool

Default: false

private_dns_zone_id

Description: The id of the private dns zone when using private-only access

Type: string

Default: null

suffix

Description: Naming suffix to allow multiple instances of this module

Type: string

Default: ""

Outputs

The following outputs are exported:

admin_login

Description: n/a

admin_password

Description: n/a

databases

Description: n/a

server_fqdn

Description: FQDN of the database service

Development

Use the terraform module tools to check and generate the documentation by running

docker run -v "$PWD":/terraform ghcr.io/dodevops/terraform-module-tools:latest