azurermMysqlServer
Manages a MySQL Server.
Example Usage
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
this,
"example",
{
location: "West Europe",
name: "example-resources",
}
);
const azurermMysqlServerExample = new azurerm.mysqlServer.MysqlServer(
this,
"example_1",
{
administrator_login: "mysqladminun",
administrator_login_password: "H@Sh1CoR3!",
auto_grow_enabled: true,
backup_retention_days: 7,
geo_redundant_backup_enabled: false,
infrastructure_encryption_enabled: false,
location: azurermResourceGroupExample.location,
name: "example-mysqlserver",
public_network_access_enabled: true,
resource_group_name: azurermResourceGroupExample.name,
sku_name: "B_Gen5_2",
ssl_enforcement_enabled: true,
ssl_minimal_tls_version_enforced: "TLS1_2",
storage_mb: 5120,
version: "5.7",
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermMysqlServerExample.overrideLogicalId("example");
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. -
resourceGroupName
- (Required) The name of the resource group in which to create the MySQL Server. Changing this forces a new resource to be created. -
location
- (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. -
skuName
- (Required) Specifies the SKU Name for this MySQL Server. The name of the SKU, follows thetier
+family
+cores
pattern (e.g.bGen41
,gpGen58
). For more information see the product documentation. Possible values arebGen41
,bGen42
,bGen51
,bGen52
,gpGen42
,gpGen44
,gpGen48
,gpGen416
,gpGen432
,gpGen52
,gpGen54
,gpGen58
,gpGen516
,gpGen532
,gpGen564
,moGen52
,moGen54
,moGen58
,moGen516
andmoGen532
. -
version
- (Required) Specifies the version of MySQL to use. Valid values are57
, or80
. Changing this forces a new resource to be created. -
administratorLogin
- (Optional) The Administrator login for the MySQL Server. Required whencreateMode
isdefault
. Changing this forces a new resource to be created. -
administratorLoginPassword
- (Optional) The Password associated with theadministratorLogin
for the MySQL Server. Required whencreateMode
isdefault
. -
autoGrowEnabled
- (Optional) Enable/Disable auto-growing of the storage. Storage auto-grow prevents your server from running out of storage and becoming read-only. If storage auto grow is enabled, the storage automatically grows without impacting the workload. The default value if not explicitly specified istrue
. -
backupRetentionDays
- (Optional) Backup retention days for the server, supported values are between7
and35
days. -
createMode
- (Optional) The creation mode. Can be used to restore or replicate existing servers. Possible values aredefault
,replica
,geoRestore
, andpointInTimeRestore
. Defaults todefault
. -
creationSourceServerId
- (Optional) For creation modes other thandefault
, the source server ID to use. -
geoRedundantBackupEnabled
- (Optional) Turn Geo-redundant server backups on/off. This allows you to choose between locally redundant or geo-redundant backup storage in the General Purpose and Memory Optimized tiers. When the backups are stored in geo-redundant backup storage, they are not only stored within the region in which your server is hosted, but are also replicated to a paired data center. This provides better protection and ability to restore your server in a different region in the event of a disaster. This is not supported for the Basic tier. -
identity
- (Optional) Anidentity
block as defined below. -
infrastructureEncryptionEnabled
- (Optional) Whether or not infrastructure is encrypted for this server. Changing this forces a new resource to be created. -
publicNetworkAccessEnabled
- (Optional) Whether or not public network access is allowed for this server. Defaults totrue
. -
restorePointInTime
- (Optional) WhencreateMode
ispointInTimeRestore
, specifies the point in time to restore fromcreationSourceServerId
. It should be provided in RFC3339 format, e.g.20131108T22:00:40Z
. -
sslEnforcementEnabled
- (Required) Specifies if SSL should be enforced on connections. Possible values aretrue
andfalse
. -
sslMinimalTlsVersionEnforced
- (Optional) The minimum TLS version to support on the sever. Possible values aretlsEnforcementDisabled
,tls10
,tls11
, andtls12
. Defaults totls12
. -
storageMb
- (Optional) Max storage allowed for a server. Possible values are between5120
MB(5GB) and1048576
MB(1TB) for the Basic SKU and between5120
MB(5GB) and16777216
MB(16TB) for General Purpose/Memory Optimized SKUs. For more information see the product documentation. -
threatDetectionPolicy
- (Optional) Threat detection policy configuration, known in the API as Server Security Alerts Policy. ThethreatDetectionPolicy
block supports fields documented below. -
tags
- (Optional) A mapping of tags to assign to the resource.
A identity
block supports the following:
type
- (Required) Specifies the type of Managed Service Identity that should be configured on this MySQL Server. The only possible value issystemAssigned
.
a threatDetectionPolicy
block supports the following:
-
enabled
- (Optional) Is the policy enabled? -
disabledAlerts
- (Optional) Specifies a list of alerts which should be disabled. Possible values aresqlInjection
,sqlInjectionVulnerability
,accessAnomaly
,dataExfiltration
andunsafeAction
. -
emailAccountAdmins
- (Optional) Should the account administrators be emailed when this alert is triggered? -
emailAddresses
- (Optional) A list of email addresses which alerts should be sent to. -
retentionDays
- (Optional) Specifies the number of days to keep in the Threat Detection audit logs. -
storageAccountAccessKey
- (Optional) Specifies the identifier key of the Threat Detection audit storage account. -
storageEndpoint
- (Optional) Specifies the blob storage endpoint (e.g. https://example.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs.
Attributes Reference
The following attributes are exported:
-
id
- The ID of the MySQL Server. -
fqdn
- The FQDN of the MySQL Server.
An identity
block exports the following:
-
principalId
- The Principal ID associated with this Managed Service Identity. -
tenantId
- The Tenant ID associated with this Managed Service Identity.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 60 minutes) Used when creating the MySQL Server.update
- (Defaults to 60 minutes) Used when updating the MySQL Server.read
- (Defaults to 5 minutes) Used when retrieving the MySQL Server.delete
- (Defaults to 60 minutes) Used when deleting the MySQL Server.
Import
MySQL Server's can be imported using the resourceId
, e.g.