Giter VIP home page Giter VIP logo

terraform-azurerm-db-mysql's Introduction

Azure Managed Mysql Service

Changelog Notice Apache V2 License TF Registry

This Terraform module creates an Azure MySQL server with databases and associated admin users along with logging activated and firewall rules.

Requirements

Version compatibility

Module version Terraform version AzureRM version
>= 4.x.x 0.13.x >= 2.10
>= 3.x.x 0.12.x >= 2.10
>= 2.x.x, < 3.x.x 0.12.x < 2.0
< 2.x.x 0.11.x < 2.0

Usage

This module is optimized to work with the Claranet terraform-wrapper tool which set some terraform variables in the environment needed by this module. More details about variables set by the terraform-wrapper available in the documentation.

module "azure-region" {
  source  = "claranet/regions/azurerm"
  version = "x.x.x"

  azure_region = var.azure_region
}

module "rg" {
  source  = "claranet/rg/azurerm"
  version = "x.x.x"

  location    = module.azure-region.location
  client_name = var.client_name
  environment = var.environment
  stack       = var.stack
}

module "mysql" {
  source  = "claranet/db-mysql/azurerm"
  version = "x.x.x"

  client_name          = var.client_name
  environment          = var.environment
  location             = module.azure-region.location
  location_short       = module.azure-region.location_short
  resource_group_name  = module.rg.resource_group_name
  stack                = var.stack

  tier     = "GeneralPurpose"
  capacity = 4

  allowed_cidrs = ["10.0.0.0/24", "12.34.56.78/32"]

  storage_mb                   = 5120
  backup_retention_days        = 10
  geo_redundant_backup_enabled = true
  auto_grow_enabled            = false

  administrator_login    = var.administrator_login
  administrator_password = var.administrator_password
  databases_names        = ["my_database"]

  force_ssl             = true
  mysql_options         = [{name="interactive_timeout", value="600"}, {name="wait_timeout", value="260"}]
  mysql_version         = "5.7"
  databases_charset     = {
    "my_database" = "utf8"
  }
  databases_collation   = {
    "my_database" = "utf8_general_ci"
  }

  logs_destinations_ids = [
    data.terraform_remote_state.run.outputs.logs_storage_account_id,
    data.terraform_remote_state.run.outputs.log_analytics_workspace_id
  ]

  extra_tags = var.extra_tags
}

Inputs

Name Description Type Default Required
administrator_login MySQL administrator login string n/a yes
administrator_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
allowed_cidrs List of authorized cidrs list(string) n/a yes
allowed_subnets List of authorized subnet ids list(string) [] no
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
capacity Capacity for MySQL server sku: https://www.terraform.io/docs/providers/azurerm/r/mysql_server.html#capacity number 4 no
client_name Name of client string n/a yes
create_databases_users True to create a user named (_user) per database with generated password. bool true no
custom_server_name Custom Server Name identifier string "" no
databases_charset Valid mysql charset: https://dev.mysql.com/doc/refman/5.7/en/charset-charsets.html map(string) {} no
databases_collation Valid mysql collation: https://dev.mysql.com/doc/refman/5.7/en/charset-charsets.html map(string) {} no
databases_names List of databases names list(string) n/a yes
enable_user_suffix True to append a _user suffix to database users bool true no
environment Name of application's environnement string n/a yes
extra_tags Map of custom tags map(string) {} 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
location_short Short string for Azure location. string n/a yes
logs_categories Log categories to send to destinations. list(string) null no
logs_destinations_ids List of destination resources Ids for logs diagnostics destination. Can be Storage Account, Log Analytics Workspace and Event Hub. No more than one of each can be set. Empty list to disable logging. list(string) n/a yes
logs_metrics_categories Metrics categories to send to destinations. list(string) null no
logs_retention_days Number of days to keep logs on storage account number 30 no
mysql_options List of configuration options: https://docs.microsoft.com/fr-fr/azure/mysql/howto-server-parameters#list-of-configurable-server-parameters list(map(string)) [] no
mysql_version Valid values are 5.6 and 5.7 string "5.7" no
name_prefix Optional prefix for PostgreSQL server name string "" no
resource_group_name Name of the application ressource group, herited from infra module string n/a yes
stack Name of application stack string n/a yes
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
tier Tier for MySQL server sku: https://www.terraform.io/docs/providers/azurerm/r/mysql_server.html#tier
Possible values are: GeneralPurpose, Basic, MemoryOptimized.
string "GeneralPurpose" no

Outputs

Name Description
mysql_administrator_login Administrator login for MySQL server
mysql_configuration_id The list of all configurations resource ids
mysql_database_ids The list of all database resource ids
mysql_databases_names List of databases names
mysql_databases_users List of usernames of created users corresponding to input databases names.
mysql_databases_users_passwords List of passwords of created users corresponding to input databases names.
mysql_firewall_rule_ids List of MySQL created rules
mysql_fqdn FQDN of the MySQL server
mysql_server_id MySQL server ID
mysql_server_name MySQL server name
mysql_vnet_rule_ids The list of all vnet rule resource ids

Related documentation

Terraform Azure MySQL Server documentation: www.terraform.io/docs/providers/azurerm/r/mysql_server.html

Terraform Azure MySQL Database documentation: www.terraform.io/docs/providers/azurerm/r/mysql_database.html

Microsoft Azure documentation: docs.microsoft.com/fr-fr/azure/mysql/overview

terraform-azurerm-db-mysql's People

Contributors

shr3ps avatar cp3hu avatar rossifumax avatar bzspi avatar bd-clara avatar jmapro avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.