» azurerm_mariadb_virtual_network_rule

Manages a MariaDB Virtual Network Rule.

» Example Usage

resource "azurerm_resource_group" "example" {
  name     = "example-resources"
  location = "West Europe"
}

resource "azurerm_virtual_network" "example" {
  name                = "example-vnet"
  address_space       = ["10.7.29.0/29"]
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
}

resource "azurerm_subnet" "internal" {
  name                 = "internal"
  resource_group_name  = azurerm_resource_group.example.name
  virtual_network_name = azurerm_virtual_network.example.name
  address_prefixes     = ["10.7.29.0/29"]
  service_endpoints    = ["Microsoft.Sql"]
}

resource "azurerm_mariadb_server" "example" {
  name                         = "mariadb-server-1"
  location                     = azurerm_resource_group.example.location
  resource_group_name          = azurerm_resource_group.example.name
  administrator_login          = "mariadbadminun"
  administrator_login_password = "H@Sh1CoR3!"
  version                      = "5.7"
  ssl_enforcement              = "Enabled"

  sku_name = "GP_Gen5_2"

  storage_profile {
    storage_mb            = 5120
    backup_retention_days = 7
    geo_redundant_backup  = "Disabled"
  }
}

resource "azurerm_mariadb_virtual_network_rule" "example" {
  name                = "mariadb-vnet-rule"
  resource_group_name = azurerm_resource_group.example.name
  server_name         = azurerm_mariadb_server.example.name
  subnet_id           = azurerm_subnet.internal.id
}

» Argument Reference

The following arguments are supported:

  • name - (Required) The name of the MariaDB Virtual Network Rule. Cannot be empty and must only contain alphanumeric characters and hyphens. Cannot start with a number, and cannot start or end with a hyphen. Changing this forces a new resource to be created.
  • resource_group_name - (Required) The name of the resource group where the MariaDB server resides. Changing this forces a new resource to be created.

  • server_name - (Required) The name of the SQL Server to which this MariaDB virtual network rule will be applied to. Changing this forces a new resource to be created.

  • subnet_id - (Required) The ID of the subnet that the MariaDB server will be connected to.

» Attributes Reference

The following attributes are exported:

  • id - The ID of the MariaDB Virtual Network Rule.

» Timeouts

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

  • create - (Defaults to 30 minutes) Used when creating the MariaDB Virtual Network Rule.
  • update - (Defaults to 30 minutes) Used when updating the MariaDB Virtual Network Rule.
  • read - (Defaults to 5 minutes) Used when retrieving the MariaDB Virtual Network Rule.
  • delete - (Defaults to 30 minutes) Used when deleting the MariaDB Virtual Network Rule.

» Import

MariaDB Virtual Network Rules can be imported using the resource id, e.g.

terraform import azurerm_mariadb_virtual_network_rule.rule1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/MariaDB/servers/myserver/virtualNetworkRules/vnetrulename