azurerm_mysql_server
Manages a MySQL Server.
Example Usage
resource "azurerm_resource_group" "test" { name = "api-rg-pro" location = "West Europe" } resource "azurerm_mysql_server" "test" { name = "mysql-server-1" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" sku { name = "B_Gen4_2" capacity = 2 tier = "Basic" family = "Gen4" } storage_profile { storage_mb = 5120 backup_retention_days = 7 geo_redundant_backup = "Disabled" } administrator_login = "mysqladminun" administrator_login_password = "H@Sh1CoR3!" version = "5.7" ssl_enforcement = "Enabled" }
Argument Reference
The following arguments are supported:
-
name
- (Required) Specifies the name of the MySQL Server. Changing this forces a new resource to be created. This needs to be globally unique within Azure. -
resource_group_name
- (Required) The name of the resource group in which to create the MySQL Server. -
location
- (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. -
sku
- (Required) Asku
block as defined below. -
storage_profile
- (Required) Astorage_profile
block as defined below. -
administrator_login
- (Required) The Administrator Login for the MySQL Server. Changing this forces a new resource to be created. -
administrator_login_password
- (Required) The Password associated with theadministrator_login
for the MySQL Server. -
version
- (Required) Specifies the version of MySQL to use. Valid values are5.6
and5.7
. Changing this forces a new resource to be created. -
ssl_enforcement
- (Required) Specifies if SSL should be enforced on connections. Possible values areEnforced
andDisabled
. -
tags
- (Optional) A mapping of tags to assign to the resource.
sku
supports the following:
-
name
- (Required) Specifies the SKU Name for this MySQL Server. The name of the SKU, follows thetier
+family
+cores
pattern (e.g. B_Gen4_1, GP_Gen5_8). For more information see the product documentation. -
capacity
- (Required) The scale up/out capacity, representing server's compute units. -
tier
- (Required) The tier of the particular SKU. Possible values areBasic
,GeneralPurpose
, andMemoryOptimized
. For more information see the product documentation. -
family
- (Required) Thefamily
of hardwareGen4
orGen5
, before selecting yourfamily
check the product documentation for availability in your region.
storage_profile
supports the following:
-
storage_mb
- (Required) Max storage allowed for a server. Possible values are between5120
MB(5GB) and1048576
MB(1TB) for the Basic SKU and between5120
MB(5GB) and4194304
MB(4TB) for General Purpose/Memory Optimized SKUs. For more information see the product documentation. -
backup_retention_days
- (Optional) Backup retention days for the server, supported values are between7
and35
days. -
geo_redundant_backup
- (Optional) Enable Geo-redundant or not for server backup. Valid values for this property areEnabled
orDisabled
, not supported for thebasic
tier.
Attributes Reference
The following attributes are exported:
Import
MySQL Server's can be imported using the resource id
, e.g.
terraform import azurerm_mysql_server.server1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.DBforMySQL/servers/server1
© 2018 HashiCorpLicensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/azurerm/r/mysql_server.html