Skip to content

azurermMariadbDatabase

Manages a MariaDB Database within a MariaDB 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: "tfex-mariadb-database-RG",
  }
);
const azurermMariadbServerExample = new azurerm.mariadbServer.MariadbServer(
  this,
  "example_1",
  {
    administrator_login: "acctestun",
    administrator_login_password: "H@Sh1CoR3!",
    backup_retention_days: 7,
    geo_redundant_backup_enabled: false,
    location: azurermResourceGroupExample.location,
    name: "mariadb-svr",
    resource_group_name: azurermResourceGroupExample.name,
    sku_name: "B_Gen5_2",
    ssl_enforcement_enabled: true,
    storage_mb: 51200,
    version: "10.2",
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermMariadbServerExample.overrideLogicalId("example");
const azurermMariadbDatabaseExample =
  new azurerm.mariadbDatabase.MariadbDatabase(this, "example_2", {
    charset: "utf8mb4",
    collation: "utf8mb4_unicode_520_ci",
    name: "mariadb_database",
    resource_group_name: azurermResourceGroupExample.name,
    server_name: azurermMariadbServerExample.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.*/
azurermMariadbDatabaseExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • name - (Required) Specifies the name of the MariaDB Database, which needs to be a valid MariaDB identifier. Changing this forces a new resource to be created.

  • serverName - (Required) Specifies the name of the MariaDB Server. Changing this forces a new resource to be created.

  • resourceGroupName - (Required) The name of the resource group in which the MariaDB Server exists. Changing this forces a new resource to be created.

  • charset - (Required) Specifies the Charset for the MariaDB Database, which needs to be a valid MariaDB Charset. Changing this forces a new resource to be created.

  • collation - (Required) Specifies the Collation for the MariaDB Database, which needs to be a valid MariaDB Collation. Changing this forces a new resource to be created.

Attributes Reference

The following attributes are exported:

  • id - The ID of the MariaDB Database.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 60 minutes) Used when creating the MariaDB Database.
  • update - (Defaults to 60 minutes) Used when updating the MariaDB Database.
  • read - (Defaults to 5 minutes) Used when retrieving the MariaDB Database.
  • delete - (Defaults to 60 minutes) Used when deleting the MariaDB Database.

Import

MariaDB Database's can be imported using the resourceId, e.g.

terraform import azurerm_mariadb_database.database1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.DBforMariaDB/servers/server1/databases/database1