azurermMysqlFlexibleDatabase
Manages a MySQL Database within a MySQL Flexible 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.*/
new azurerm.provider.AzurermProvider(this, "azurerm", {
features: [{}],
});
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
this,
"example",
{
location: "West Europe",
name: "example-resources",
}
);
const azurermMysqlFlexibleServerExample =
new azurerm.mysqlFlexibleServer.MysqlFlexibleServer(this, "example_2", {
administrator_login: "mysqladminun",
administrator_password: "H@Sh1CoR3!",
location: azurermResourceGroupExample.location,
name: "example-mysql-flexible-server",
resource_group_name: azurermResourceGroupExample.name,
sku_name: "B_Standard_B1s",
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermMysqlFlexibleServerExample.overrideLogicalId("example");
const azurermMysqlFlexibleDatabaseExample =
new azurerm.mysqlFlexibleDatabase.MysqlFlexibleDatabase(this, "example_3", {
charset: "utf8",
collation: "utf8_unicode_ci",
name: "exampledb",
resource_group_name: azurermResourceGroupExample.name,
server_name: azurermMysqlFlexibleServerExample.name,
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermMysqlFlexibleDatabaseExample.overrideLogicalId("example");
Argument Reference
The following arguments are supported:
-
name
- (Required) Specifies the name of the MySQL Database, which needs to be a valid MySQL identifier. Changing this forces a new resource to be created. -
serverName
- (Required) Specifies the name of the MySQL Flexible Server. Changing this forces a new resource to be created. -
resourceGroupName
- (Required) The name of the resource group in which the MySQL Server exists. Changing this forces a new resource to be created. -
charset
- (Required) Specifies the Charset for the MySQL Database, which needs to be a valid MySQL Charset. Changing this forces a new resource to be created. -
collation
- (Required) Specifies the Collation for the MySQL Database, which needs to be a valid MySQL Collation. Changing this forces a new resource to be created.
Attributes Reference
The following attributes are exported:
id
- The ID of the MySQL Database.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 60 minutes) Used when creating the MySQL Database.update
- (Defaults to 60 minutes) Used when updating the MySQL Database.read
- (Defaults to 5 minutes) Used when retrieving the MySQL Database.delete
- (Defaults to 60 minutes) Used when deleting the MySQL Database.
Import
MySQL Database's can be imported using the resourceId
, e.g.